looping thru drawings

looping thru drawings

Anonymous
Not applicable
266 Views
2 Replies
Message 1 of 3

looping thru drawings

Anonymous
Not applicable
Hi All,

I have used the commondialog to select multiple drawings.I know that the . ParseFileNames returns an array of files selected.Now I need to loop through these drawings -opening each one,making changes and then saving the drawing.
Can anyone please help me with it.Code for this will be helpful and appreciated.

Thanks,
Avantika
0 Likes
267 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
Here si some quick code to get you started (Assume you run it in a VBA
subroutine)

Dim app As AcadApplication
Dim dwg As AcadDocument
Dim i As Integer

Set app=ThisDrawing.Application
mStop=False '' a form level variable, default to False

For i=0 To Ubound(dwgnameArray)

''Open each drawing
Set dwg=app.Documents.Open(dwgnameArray(i))

''Do something to the drawing by referring the the varaiable dwg

''Close the drawing, save or not save changes
dwg.Close True ''Save the changes to the drawing, or "dwg.Close False"
if you do not want to save changes

''You may want to stop the looping by provide a "Stop" button. Do Events
allows the click on the Stop button
DoEvents
If mStop Then Exit For

Next

At Form level you should have

Private mStop As Boolean

Private Sub CommandButtonStop_Click()
mStop=True
End Sub


wrote in message news:5206319@discussion.autodesk.com...
Hi All,

I have used the commondialog to select multiple drawings.I know that the .
ParseFileNames returns an array of files selected.Now I need to loop through
these drawings -opening each one,making changes and then saving the drawing.
Can anyone please help me with it.Code for this will be helpful and
appreciated.

Thanks,
Avantika
0 Likes
Message 3 of 3

Anonymous
Not applicable
I tried using this...but its giving me a "subscript out of range" error at the for loop. Can u please help me figure it out.
0 Likes