Loop is closing more drawings then needed

Loop is closing more drawings then needed

Anonymous
Not applicable
265 Views
3 Replies
Message 1 of 4

Loop is closing more drawings then needed

Anonymous
Not applicable
I have to open up 2 blank drawings sometimes because it will close down additional drawings. In my extract Sub, I do not have any function or anything to close down a drawing. For some reason, it will get to the .close, and close the one drawing right behind it before closing the active drawing. Any ideas of how to fix this error?

~Thanks

For h = 0 To (intListCount - 1)

With Application
.Documents.Open lstElemDwgs.List(h)
Extract_TB_RefBlocks 'Extract Elem Diagrams
.ActiveDocument.Close
End With

Next h
'Reset users SDI mode
Application.ActiveDocument.SetVariable "SDI", PreviousSDIMode
0 Likes
266 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
Why not control which doc you want to use?
Dim oDoc as AcadDocument
With Application
Set oDoc = .Documents.Open (lstElemDwgs.List(h))
Extract_TB_RefBlocks 'Extract Elem Diagrams
oDoc.Close
End With
hth
Mark

wrote in message news:5821986@discussion.autodesk.com...
I have to open up 2 blank drawings sometimes because it will close down
additional drawings. In my extract Sub, I do not have any function or
anything to close down a drawing. For some reason, it will get to the
.close, and close the one drawing right behind it before closing the active
drawing. Any ideas of how to fix this error?

~Thanks

For h = 0 To (intListCount - 1)

With Application
.Documents.Open lstElemDwgs.List(h)
Extract_TB_RefBlocks 'Extract Elem Diagrams
.ActiveDocument.Close
End With

Next h
'Reset users SDI mode
Application.ActiveDocument.SetVariable "SDI", PreviousSDIMode
0 Likes
Message 3 of 4

Anonymous
Not applicable
Thanks you for the response. This solved my problem

~Cheers
0 Likes
Message 4 of 4

Anonymous
Not applicable
Glad that helped.
:-)
Mark

wrote in message news:5823016@discussion.autodesk.com...
Thanks you for the response. This solved my problem

~Cheers
0 Likes