Introduction to ActiveX controls
It’s great that you have already reached this part of the VBA Tutorial. VBA ActiveX controls are controls used to visualize our applications in Excel. ActiveX controls available in the Developer tab are used primarily to build simple applications running under Excel.
For the construction of slightly more difficult applications, we will use UserForm controls available in the VisualBasic Editor. To use the ActiveX controls in Excel, enter the Developer tab, then Insert > ActiveX controls.
If you would like to build more advanced application, ie. using the UserForm form you need enter the VisualBasic Editor. In the Project window, click on the insert and select UserForm. Then, to the inserted form in this way, you can already insert controls using the ToolBox window .
Types of ActiveX controls
You can assign VBA code for each of these controls. From the most popular ActiveX controls, you will use:
- OptionButton / RadioButton
- Application page tabs (MultiPage)
Triggers ActiveX controls
In the previous section, I described an example of running a simple program by simply clicking the CommandButton button . In this case, one click is the triggering of our program – it runs it.
In VBA in Excel, you can also define other triggers for your programs. This can be, for example, a double-click, an error, hovering over a button. Triggers are defined by double clicking on your button in design mode.
Properties of ActiveX controls
Each control in Excel VBA has its own properties. You can use them to set parameters such as position, font, colors, etc. Below is a list of the CommandButton control properties: