.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

SendCommand and ActiveX/VBA

2 REPLIES 2
Reply
Message 1 of 3
not.testee
479 Views, 2 Replies

SendCommand and ActiveX/VBA

Hello,

I am trying to understand what the AutoCAD API developers guide is trying to say about "SendCommand" but I cannot get the code to work. I think I either need to download the VBA reference for AutoCAD 2010 or something for ActiveX. Previous unhandled exception have been thrown indicating that the executable cannot create ActiveX component. And this was when I was trying to draw a simple circle just to test functionality.

Can someone please steer me in the right direction as to where to find the resource to get the "SendCommand" feature to work. I need to execute commands prior to dumping .NET Form and not after.

THX,
Dan
2 REPLIES 2
Message 2 of 3
not.testee
in reply to: not.testee

Hello,

This is the statement that throws the exception:

acadDoc = CreateObject("C:\\Users\nottestee\Documents\Development\SCANPOINTSCOM\3D OBJECTS.dwg")

The error says...."Cannot create ActiveX Component"

Any Advice??????

THX
Message 3 of 3
deanlyon
in reply to: not.testee

Dan,
in order to interact with AutoCAD through COM you need to use the Registry name like this:

oAcadApp = CreateObject("AutoCAD.Application.17") ' this creates a new instance of AutoCAD

OR

oAcadApp = GetObject("AutoCAD.Application.17") ' this finds a running instance of AutoCAD and attaches to it


FYI, the .17 is the version of autoCAD, if you leave that off, it will open the last opened version which may or may not be what you need.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost