jrice174
Civil/Environmental
- Nov 8, 2004
- 129
I'm attempting to write a vba program to open all the drawings in a directory. It opens the first drawing fine, but after opening the second drawing it gives me an error message "must close or hide topmost modal form first".
Here is the code:
Public Sub OpenDwgs()
DirName = "K:\_a\A05309\"
DwgNames(1) = "A0530912"
DwgNames(2) = "A0530913"
DwgNames(3) = "A0530914"
For i = 1 To 3
DwgName = DirName & DwgNames(i) & ".dwg"
MsgBox DwgName
Set CurrentDwg = Application.Documents.Open(DwgName)
'(code goes here)
CurrentDwg.Close
Next i
End Sub
Any ideas what the problem is??
Here is the code:
Public Sub OpenDwgs()
DirName = "K:\_a\A05309\"
DwgNames(1) = "A0530912"
DwgNames(2) = "A0530913"
DwgNames(3) = "A0530914"
For i = 1 To 3
DwgName = DirName & DwgNames(i) & ".dwg"
MsgBox DwgName
Set CurrentDwg = Application.Documents.Open(DwgName)
'(code goes here)
CurrentDwg.Close
Next i
End Sub
Any ideas what the problem is??