PDA

View Full Version : Run a routine in every drawing file opened



kdayman
2004-06-23, 04:31 PM
It's been a will since woring in VBA so my brain is a little rusty. Here's what I need to do. I have a plotstamp routine that triggers on the begin plot event, however now since we moved to 2005 we want to utilize this funtion in the publish command. So what I need is a way to run this on all drawings that are open. In other words I can remember for the life of me how to cycle through all the open drawings.

Jeff_M
2004-06-24, 01:23 AM
Something like this:


Dim Docs As AcadDocuments
Dim doc As AcadDocument

Set Docs = ThisDrawing.Application.Documents
For Each doc In Docs
Debug.Print (doc.Name)
Next


HTH

richard.binning
2004-06-24, 03:18 AM
It's been a will since woring in VBA so my brain is a little rusty. Here's what I need to do. I have a plotstamp routine that triggers on the begin plot event, however now since we moved to 2005 we want to utilize this funtion in the publish command. So what I need is a way to run this on all drawings that are open. In other words I can remember for the life of me how to cycle through all the open drawings.You will probably want to create an event to respond to the publish command. No need to cycle through all the open drawings everytime you open a new drawing....

Get an update for your rusty brain by visiting the Paperspace downloads page on AUGI.com and reviewing the 12 article series: "VBA Foundations for AutoCAD."

Get it here: VBA Foundations - A tutorial in VBA programming for beginners (PDF)
Title Issue Date
Part 1 (http://www.augi.com/publications/paperspace/vba_part1.pdf) March 2002
Part 2 (http://www.augi.com/publications/paperspace/vba_part2.pdf) April 2002
Part 3 (http://www.augi.com/publications/paperspace/vba_part3.pdf) May 2002
Part 4 (http://www.augi.com/publications/paperspace/vba_part4.pdf) June 2002
Part 5 (http://www.augi.com/publications/paperspace/vba_part5.pdf) July 2002
Part 6 (http://www.augi.com/publications/paperspace/vba_part6.pdf) August 2002
Part 7 (http://www.augi.com/publications/paperspace/vba_part7.pdf) Sep/Oct 2002
Part 8 (http://www.augi.com/publications/paperspace/vba_part8.pdf) Nov/Dec 2002
Part 9 (http://www.augi.com/publications/paperspace/vba_part9.pdf) Jan/Feb 2003
Part 10 (http://www.augi.com/publications/paperspace/vba_part10.pdf) Mar/Apr 2003
Part 11 (http://www.augi.com/publications/paperspace/vba_part11.pdf) May/Jun 2003
Part 12 (http://www.augi.com/publications/paperspace/vba_part12.pdf) Sep/Oct 2003