"To do this in VB, select the References option from the Project menu to
launch the Reference dialog box. From the References dialog box, choose
AutoCAD Release 15 Type Library and press OK."
Sub Ch2_ConnectToAcad()
Dim acadApp As AcadApplication
On Error Resume Next
Set acadApp = GetObject(, "AutoCAD.Application")
If Err Then
Err.Clear
Set acadApp = CreateObject("AutoCAD.Application")
If Err Then
MsgBox Err.Description
Exit Sub
End If
End If
MsgBox "Now running " + acadApp.Name + _
" version " + acadApp.Version
End Sub
For more, see AutoCAD Online Manuals:
ActiveX and VBA Developers Guide
Ch. 2 - Understanding ActiveX Automation Basics
Using Other Programming Languages
Converting VBA Code to VB
Connecting to AutoCAD from Visual Basic
--
John Goodfellow
irtf'nm
use 'microtouch' in address to email
"Doug Cochran" wrote in message
news:E68A93872F4A5A219E0DA6E8755B3A99@in.WebX.maYIadrTaRb...
> Thanks Jacob,
>
> Forgive me for sounding "dense" but just how do I set this reference?
>
> Would it be something like "Set Acad = GetObject(,
"AutoCAD.Application")"
> Where would this reference be placed i.e. as a public sub or private??!!!
> An example code would be nice!
>
> thanks again
>
>
> "Jacob Dinardi" wrote in message
> news:FE2EE7B0ACBA63E7AB6D577AC676ACB2@in.WebX.maYIadrTaRb...
> > Doug, Just make sure you have a reference set to the AutoCad type
library,
> > and you are good to go, of course you must have acad installed on the
same
> > machine.
> >
> > Regards,
> > Jacob Dinardi
> >
> >
> > Doug Cochran wrote in message
> > news:84DAD03D6C06A7FE3D2C5D4FF3810B7C@in.WebX.maYIadrTaRb...
> > Hello,
> >
> > I'm new to using VB6 in AutoCAD, but not new to using VB6.
> > How do I run AutoCAD commands in VB6? Is there some Active X control or
> DLL
> > that I need to load in order to use VB6 (not VBA) to run AutoCAD?
> >
> > Thanks in advance!
> >
> >
> >
> >
>
>