Jump to content

Recommended Posts

Posted

I'm using AutoCAD 2016. Give me a moment and I'll try it on 2018 (the only other version I have).

  • Replies 30
  • Created
  • Last Reply

Top Posters In This Topic

  • SEANT

    13

  • jackseel

    8

  • xxfaxx

    6

  • rkmcswain

    1

Top Posters In This Topic

Posted Images

Posted

Works okay with 2018. Is you project setup something like this?VBAIDE.jpg

Posted

sorry, my bad

i was using visual basic from excel, but now using it from autocad i can make the command work except with one little thingy. After i select an entity on a leyer with which to focus, i get a new error "run-time error 91, object variable or with block variable not set", and when i click the "debug" option this part "Set objRange = objExcel.ActiveWorkbook.ActiveSheet.Range("A1")" gets highlighted in yellow...

 

I suspect i am still doing something wrong.

Posted

I could make it work somehow but i cannot select the objects i want..

I mean, when i activate the command, the information goes right to excel just like that. no preselection..

well, im still learning. I changed your code a tiny bit to get the info in the cell i want.

thanks

Posted

It sounds like you're making progress. Keep asking questions and, if necessary, post the modifications you've made. The forum will respond with the necessary corrections.

Posted

Is there a book or something you recommend t see what every piece of code means?? Im using "afralisp" website and some other resources to learn autolisp and vba but i think im going to need more. I will post the code as soon as i get to the computer.

Posted

The VBA (ActiveX) Object Model used to be included with the AutoCAD Install. I haven't seen any sign of it for some time. This Russian website has what appears to be a direct copy of the documents that I remember:

http://entercad.ru/acadauto.en/

Posted

the piece of code i edited was this one

Set objRange = objExcel.ActiveWorkbook.ActiveSheet.Range("A1")

 

I changed that to this

[code]Set objRange = objExcel.ActiveCell

[/code]

 

And that allowed me to get the information to a cell in excel that i had clicked previously, instead of getting the info on the first cell.. i know it is not much of a change. Trying to understand something from all that code (without knowing anything) is quite a challange.

 

thanks for the link. i will check it out

Posted

+1 I'm trying to get started using VBA in Autocad and this is good stuff, though I must say having used Excel VBA for many years, this isn't as straightforward as I had thought it would be.

Posted

I, too, learned and did much of my early programming with Excel VBA. As I recall, The transition to AutoCAD did seem to present a conceptual/philosophical variance between the two APIs. It didn't take long, fortunately, to become familiar with the AutoCAD way of doing things. I don't perceive the discontinuity anymore, at least.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...