AutoCAD Mechanical Forum
Welcome to Autodesk’s AutoCAD Mechanical Forums. Share your knowledge, ask questions, and explore popular AutoCAD Mechanical topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Using Visual Basic other than VBA

2 REPLIES 2
Reply
Message 1 of 3
Anonymous
251 Views, 2 Replies

Using Visual Basic other than VBA

I am writing a VB program to extend the BOM from Dwgs to MS-Access. From the API help of M2004, I found this information:

Dim mcad As McadApplication
Set mcad = ThisDrawing.Application.GetInterfaceObject("Mcad.Application")

But I do not know how to change these code into Visual Basic 6 other than VBA. I wrote like this:

Dim acadApp As AcadApplication
Set acadApp = GetObject(, "AutoCAD.Application.16")

If Err Then
Err.Clear
Set acadApp = CreateObject("AutoCAD.Application.16")
If Err Then
MsgBox Err.Description
Exit Sub
End If
End If

When I run it on some other computers, sometimes it open AutoCAD2004 only but M2004, so I think McadApplication should be used here.
Could you tell me how to translate the VBA code into VB6?
Thank you very much!
2 REPLIES 2
Message 2 of 3
Anonymous
in reply to: Anonymous

pall wrote: > When I run it on some other computers, sometimes it open AutoCAD2004 only but M2004, so I think McadApplication should be used here. > Could you tell me how to translate the VBA code into VB6? > Thank you very much! GetObject simly connects to the first AutoCAD session launched while CreateObject runs whichever AutoCAD was launched last. Neither gives you the ability to choose AutoCAD Mechanical over plain AutoCAD. -- There are 10 kinds of people: those who understand binary and those who don't.
Message 3 of 3
Anonymous
in reply to: Anonymous

Thanks for your reply!
Did you mean I could not open Mechanical2004 with VB6?
Can I use any other function to do so?

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

Post to forums  

Autodesk Design & Make Report

”Boost