Select by fill colour using this macro


AskInga logo

Original Article Date: May 2006 

Updated:  July 2011

Look what you can do if you learn a little about VBA! This little application will scan the design file and select all shapes based on a user specified fill colour. Now, how cool is that? Thanks Rudi!

 

Download 296.zip and extract FindFill.mvba from the file.
Place the mvba in the folder pointed to by MS_VBASEARCHDIRECTORIES
Keyin vba load findfill to load the project, or...
Configure MS_VBAAUTOLOADPROJECTS to automatically load the mvba project upon startup.
Keyin vba run [findfill]main to run the macro, or...
Place the keyin on a function key or custom button for quick and easy access.

This macro is a great little example to learn different aspects of VBA. For example:

- Scanning for elements and refining the criteria.
- Creating a selection set from the results.
- Creating a user form and linking buttons to the code.
- Error handling and creating message boxes for each error/warning as shown below.

This program is supplied as is. AskInga, Bentley Systems Inc., and the author of the program assumes no liability for damages direct, indirect, or consequential, which may result from the use of this program. Use this program at your own risk.

AskInga Article #296