User interface related code only in User Forms

Published on April 8, 2011

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.

Like this article? Share it!

One Response to “User interface related code only in User Forms”

  1. Envision Newsletter April 2011 - Envision CAD | MicroStation Training & InRoads Training Says:

    April 21st, 2011 at 3:54 pm

    […] VBA: User interface related code only in User Forms […]

Leave a Comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Privacy Policy