Tip 2261: Pick a Folder Dialog Box VBA is a programming language you can use to customize a variety of software solutions in addition to AutoCAD -- primarily Microsoft Office products such as Word, Excel, Outlook, and Access. Not surprisingly, VBAcomes with a host of interesting features that have nothing to do with AutoCAD. Communicating with the operating system and using features shared by other applications is something that occasionally yields some valuable treasure. This tip presents a dialog box that prompts the user to select a folder. Although the common file dialog box could be used for this purpose, another option is available inside the basic tools of Windows. The module file BROWSEFOLDER.BAS contains the code needed to display the folder dialog box inside VBA. Inside your VBA code, you will now have a function named BrowseFolder that will return a string of the folder name selected. As noted, this function is used in the previous tip, Process All Drawings in a Folder, to select a folder to process (and as an example). Other systems functions inside of Windows also may be of interest. You can learn more about these tools on the Microsoft Developer Network (MSDN) Web site, or you can often find exactly what you need through a general Internet search or by asking fellow users at the Cadalyst Hot Tip Harry Discussion Forums. |