Announcements

Announcement: We’re aware of an issue affecting starting a new topic from category pages and creating new blog posts. New topics can still be started directly from the relevant board. Learn more here.

ATL ObjectArx works from Acad VBA but not from VB

ATL ObjectArx works from Acad VBA but not from VB

Anonymous
Not applicable
303 Views
2 Replies
Message 1 of 3

ATL ObjectArx works from Acad VBA but not from VB

Anonymous
Not applicable
Hi All,

I'm trying to create a ATL (COM Application) and I'm confused here.

First scenario:
I created a ATL project, added an ATL Object & added a method to it,
then I added the ObjectArx code and it loaded fine in AutoCAD Map and the
AcadTest module run successfully from AutoCAD Map.

I wrote a simple module in AutoCAD Map VBA to communicate with the ATL
Object I created and it worked fine.

The problem is when I copied the same code in VBA under Excel, it gave
me an error when creating the Object "Set sTest = New MyAtlObject.MyMethod"
it gave me the following error: "Automation Error. The specified module
could not be found"



The second scenario:
I created an ObjectArx project from VC++ and added an ATL Object from
the ObjectArx Toolbar, and created a method.

I end up with the same problem.


I even made a reg file for the application with no luck. Also when I try to
run the "Register Control" from the VC++ "Tolls" menu, it gives me the
following error: "The specified module could not be found".
Can anyone tell me what's wrong here as this is driving me nuts. Your help
will be deeply appreciated.


Best regards

Wael Bakr
0 Likes
304 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
An ARX COM server must be loaded into AutoCAD's process
(either as an ARX module or a standard COM server).

To do this from an out-of-process client, you have to
use the GetInterfaceObject() method of the AutoCAD
Application object.

When you create an ActiveX object using the 'New' keyword
in VB or VBA, it tries to load the ActiveX object into the
host process, which is not Acad.exe.

Just load your COM server like this:

Dim Acad As AcadApplication
Dim YourObject As .
Set Acad = GetObject(, "AutoCAD.Application")
Set YourObject = Acad.GetInterfaceObject("")



"Wael Bakr" wrote in message
news:[email protected]...
> Hi All,
>
> I'm trying to create a ATL (COM Application) and I'm confused here.
>
> First scenario:
> I created a ATL project, added an ATL Object & added a method to it,
> then I added the ObjectArx code and it loaded fine in AutoCAD Map and the
> AcadTest module run successfully from AutoCAD Map.
>
> I wrote a simple module in AutoCAD Map VBA to communicate with the ATL
> Object I created and it worked fine.
>
> The problem is when I copied the same code in VBA under Excel, it gave
> me an error when creating the Object "Set sTest = New
MyAtlObject.MyMethod"
> it gave me the following error: "Automation Error. The specified module
> could not be found"
>
>
>
> The second scenario:
> I created an ObjectArx project from VC++ and added an ATL Object from
> the ObjectArx Toolbar, and created a method.
>
> I end up with the same problem.
>
>
> I even made a reg file for the application with no luck. Also when I try
to
> run the "Register Control" from the VC++ "Tolls" menu, it gives me the
> following error: "The specified module could not be found".
> Can anyone tell me what's wrong here as this is driving me nuts. Your help
> will be deeply appreciated.
>
>
> Best regards
>
> Wael Bakr
>
>
0 Likes
Message 3 of 3

Anonymous
Not applicable
Tony,
Thanks, with your support, I'm going full speed.

Best regards

wael Bakr

"Tony Tanzillo" wrote in message
news:[email protected]...
> An ARX COM server must be loaded into AutoCAD's process
> (either as an ARX module or a standard COM server).
>
> To do this from an out-of-process client, you have to
> use the GetInterfaceObject() method of the AutoCAD
> Application object.
>
> When you create an ActiveX object using the 'New' keyword
> in VB or VBA, it tries to load the ActiveX object into the
> host process, which is not Acad.exe.
>
> Just load your COM server like this:
>
> Dim Acad As AcadApplication
> Dim YourObject As .
> Set Acad = GetObject(, "AutoCAD.Application")
> Set YourObject = Acad.GetInterfaceObject("")
>
>
>
> "Wael Bakr" wrote in message
> news:[email protected]...
> > Hi All,
> >
> > I'm trying to create a ATL (COM Application) and I'm confused here.
> >
> > First scenario:
> > I created a ATL project, added an ATL Object & added a method to it,
> > then I added the ObjectArx code and it loaded fine in AutoCAD Map and
the
> > AcadTest module run successfully from AutoCAD Map.
> >
> > I wrote a simple module in AutoCAD Map VBA to communicate with the
ATL
> > Object I created and it worked fine.
> >
> > The problem is when I copied the same code in VBA under Excel, it
gave
> > me an error when creating the Object "Set sTest = New
> MyAtlObject.MyMethod"
> > it gave me the following error: "Automation Error. The specified module
> > could not be found"
> >
> >
> >
> > The second scenario:
> > I created an ObjectArx project from VC++ and added an ATL Object
from
> > the ObjectArx Toolbar, and created a method.
> >
> > I end up with the same problem.
> >
> >
> > I even made a reg file for the application with no luck. Also when I try
> to
> > run the "Register Control" from the VC++ "Tolls" menu, it gives me the
> > following error: "The specified module could not be found".
> > Can anyone tell me what's wrong here as this is driving me nuts. Your
help
> > will be deeply appreciated.
> >
> >
> > Best regards
> >
> > Wael Bakr
> >
> >
>
>
0 Likes