Tip 2260: Process All Drawings in a Folder Just as you can apply commands to every open drawing using a routine like the one above, you also can apply commands to every drawing in a folder, except in this latter case the routine actually opens drawings rather than just accessing them. This tip, supplied for import as the module file RUNFOLDER.BAS, requires the presence of the next tip (Pick a Folder Dialog Box) in the same project. The concept is to use the DIR function of VBA to loop through a selected folder of drawings. Each drawing is opened, and a series of commands is applied (in this case, just a simple zoom) before the drawing is closed with a save back to the disk. If you have folders full of drawings and need to run a set of AutoCAD commands against each, then this code may be just the answer in terms of a basic template. Once again, the SendCommand method of the drawing object is used to manipulate the drawing. With the drawing open, VBA routines can accomplish much more, such as directly manipulating objects, cleaning up tables, and revising references. |