User interface related code only in User Forms

A common practice for beginning developers is to place the macro processing code in the OK (or Apply) button click event sub of a User Form. While this may be easy, and keeps everything in one spot, it is not recommended. The only code in your User Forms should be the code required to collect and verify user inputs.

The actual processing code for your macros should be placed in separate code and/or class modules. Designing your processing code with multiple functions and subs divided logically in to different modules and classes promotes reusability and portability.


Since 1996, EnvisionCAD has been a nationally recognized leader in the configuration, customization, implementation, training & support for CAD software solutions. Our individualized approach has benefited private engineering firms and government agencies alike. Basic or advanced, we can help you get the most from your CAD technology.


Leave a Reply

Your email address will not be published. Required fields are marked *