New to VB/VBA- AutoCAD session thru VB

New to VB/VBA- AutoCAD session thru VB

Anonymous
Not applicable
236 Views
2 Replies
Message 1 of 3

New to VB/VBA- AutoCAD session thru VB

Anonymous
Not applicable
Trying to start an AutoCAD session thru VB...
1- having MMapp as my AutoCAD.Application,
what is the difference between ...

Set MMapp = CreateObject("AutoCAD.Application")
Set MMapp = New AutoCAD.AcadApplication

2- how would I detect if a previous session
of AutoCAD is already running, so add a new
document in the running app,
MMapp.Documents.Add or .Open
instead of opening a brand new app.

if there are some samples, please post.

thanks
Mark
0 Likes
237 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
Don't forget to set a reference to AutoCAD


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
Exit Sub
End If
End If
0 Likes
Message 3 of 3

Anonymous
Not applicable
Very Helpful and to the point!
Thanks

"nobody" wrote in message
news:f127043.0@WebX.maYIadrTaRb...
> Don't forget to set a reference to AutoCAD
>
>
> 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
> Exit Sub
> End If
> End If
>
>
0 Likes