What Is a User Form Object

A UserForm object can be thought of as a standard code module with a visual interface (a form) that is used to interact with the user (hence the term UserForm). However, we must be careful not to take this description too literally. For instance, procedures (even public ones) that are declared in the General section of a UserForm module are generally intended to support objects (or code) on the form itself, whereas public procedures declared in a standard module are generally intended to support code anywhere in the project (not just in its own module).

To illustrate the point, suppose we declare a public procedure called ProcedureA in the General section of a UserForm module called UserForm1. Even though this procedure is public, we cannot access it from another module (even within the same project) by simply writing:

ProcedureA

as we could if the procedure was defined within a standard module. Instead, we must use the qualified name:

UserForml.ProcedureA

0 0

Post a comment