The VBE provides a name for each control you add to a UserForm. The control's name corresponds to its Name property. Use this name to refer to a particular control in your code. For example, if you add a CheckBox control to a UserForm named UserForm1, the CheckBox control is named CheckBox1 by default. The following statement makes this control appear with a check mark:
UserForml.CheckBoxl.Value = True
Your VBA code can also check various properties of the controls and take appropriate actions. The following statement executes a macro named PrintReport if the check box (named CheckBox1) is checked:
If UserForml.CheckBoxl.Value = True Then Call PrintReport
I discuss this topic in detail in the next chapter.
Was this article helpful?