- Developers open the Visual Basic development environment by clicking the "Visual Basic" command of Excel's "Developer" tab. In this environment, they'll create a userform to host a checkbox by clicking the "Userform" command of the "Insert" menu. Developers will drag the checkbox control from the development environment's toolbox onto the form, usually along with other controls and prompts for other user data.
- Once the checkbox is on a userform, developers will adjust the appearance and behavior of the checkbox by using this control's "Properties" window, which they display by right-clicking the checkbox and clicking "Properties." This window lists many attributes for the checkbox, but developers typically only need to set a few of them. One is the "Caption" property, which provides a descriptive label for the checkbox. For example, a developer might write the following text in the "Caption" property of a checkbox for a question about subscription preferences: "Subscribe me to your newsletter."
- The developers set attributes of the checkbox that let them write programming statements for controlling the checkbox. For example, they'll set the "Name" attribute of a checkbox to something that's easy to remember and that relates to the purpose of the checkbox. For example, a developer might set the "Name" attribute of a checkbox indicating a user's subscription preference to "cbxSubscribeMe."
- After setting a checkbox's attributes for its appearance and behavior, developers write code that Excel will execute once the program's user checks or unchecks the checkbox. They write this code in an event function called "Click." An event function is one that Excel runs when a mouse click, keypress or other action happens. In the "Click" event for a checkbox indicating user subscription preferences, the developer might write code that removes or adds the user's name from a database table named "Subscribers."
next post