|
-
Feb 23rd, 2004, 11:33 AM
#1
Thread Starter
New Member
Opening an ACAD drawing Error: MDI mode!
I can't seem to open an Autocad drawing in VBA. i keep getting a Collection not available in MDI mode error. Use documents. Here's the code I'm trying to run.
VB Code:
Set acad = CreateObject("Autocad.Application")
Set acad = GetObject(, "AutoCAD.Application")
acad.Visible = False
'Hide the dialogue box
Set acaDoc = acad.ActiveDocument
acaDoc.Open "C:\Projects\W7ls0116.dwg"
Set pViewport = acaDoc.ActiveViewport
pViewport.ZoomExtents
Set sset = acaDoc.SelectionSets.Add("NEWSS")
sset.Select acSelectionSetAll Set acad = CreateObject
-
Feb 25th, 2004, 04:21 AM
#2
You should only need the 1st line rather than the top 2 - try commenting out the 2nd line to start with.
What line does this fall over on? & what is the bottom line there meant to do please?
-
Mar 5th, 2004, 03:31 AM
#3
New Member
Hope this will work...
Code:
--------------------------------------------------------------------
Dim acadApp As AcadApplication
Set acadApp = GetObject(, "AutoCAD.Application")
If Err Then
Err.Clear
'Open AutoCAD app if not already open
Set acadApp = CreateObject("AutoCAD.Application")
acadApp.Visible = True
If Err Then
MsgBox Err.Description
Exit Sub
End If
End If
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|