opening a second drawing

#1
I am having difficulty opening a second drawing from within VBA. I have successfuly performed a SAVEAS on the first drawing and need to open a different template drawing. the command line I have been trying is:

Application.Documents.Open "C:\My Documents\Materials\auto second.dwg"

This does open the drawing but creates the following error message:

Run-Time error '5':
invalid procedure call or argument

I have tried "on error resume next", but nothing seems to work.

Thanks for your help.

#2
Try

Sub OpenDrawing()

Dim objDrawing As Document
Dim strDrawingName As String
strDrawingName = "C:\My Documents\Materials\auto second.dwg"

' Loop through each Document to see if drawing has been opened
' If not then open it
For Each objDrawing In Documents
If objDrawing.Name = "auto second.dwg" Then
MsgBox "Drawing Already Open", vbInformation
Exit Sub
End If
Next

Application.Documents.Open (strDrawingName)

End Sub




------------------
Regards
John Finlay