Author Topic: Accessing AutoCAD from other Program  (Read 1149 times)

0 Members and 1 Guest are viewing this topic.

robplatt

  • Guest
Accessing AutoCAD from other Program
« on: April 05, 2007, 07:18:47 AM »
Hi all,
Í've successfully sent stuff from ACAD to Excel and Access, and now i'm trying to do the reverse - ie. access ACAD from Excel using VBA.
I have cobbled together a routine that seems to work, but it needs the line:
    Set acadApp = GetObject(, "AutoCAD.Application.16")
I understand all of this except the reference to "16". I gather this is a version reference (I'm using 2006), but where can I find what number to use for other versions?
Your comments greatfully received as always!

Glenn R

  • Water Moccasin
  • Posts: 1932
  • What idiot child of married cousins wrote this?!
Re: Accessing AutoCAD from other Program
« Reply #1 on: April 05, 2007, 08:13:00 AM »
Registry.
Me

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16721
  • Superior Stupidity at its best
Re: Accessing AutoCAD from other Program
« Reply #2 on: April 05, 2007, 11:15:55 AM »
If you don't bother with the version, it will find the current application loaded regardless of version.

i.e.
Code: [Select]
Set acadApp = GetObject(, "AutoCAD.Application")
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Dnereb

  • Guest
Re: Accessing AutoCAD from other Program
« Reply #3 on: April 10, 2007, 12:35:53 PM »
If you want to bother with versions some stations have multiple Acad versions installed, you need to use diffrent code for diffrent versions etc.... this might help you out, it's written for several apps.

robplatt

  • Guest
Re: Accessing AutoCAD from other Program
« Reply #4 on: April 25, 2007, 06:26:24 AM »
Thanks Dnereb,
I think I'll probably need something like this.

ML

  • Guest
Re: Accessing AutoCAD from other Program
« Reply #5 on: April 26, 2007, 11:30:07 AM »

As Keith mentioned, if you need to be version specific, just type in the version as shown below

Code: [Select]
Set ACADApp = GetObject(, "AutoCAD.Application.16.2")

Mark

ML

  • Guest
Re: Accessing AutoCAD from other Program
« Reply #6 on: May 11, 2007, 10:23:14 AM »

Hey Rob,

Going back to your original question, if you need the specific version of ACAD  that you are using, you can use a very simple macro like

Code: [Select]
Sub Version()
MsgBox Application.Version
End Sub

The message box will return the version for you

Mark