Introduction to ActiveX controls in Excel VBA

Introduction to ActiveX controls

It’s great that you have already reached this part of the VBA TutorialVBA 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.

Introduction to VBA ActiveX controls
Introduction to VBA 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 .

VBA ActiveX Controls – UserForm, ToolBox

Types of ActiveX controls

You can assign VBA code for each of these controls. From the most popular ActiveX controls, you will use:

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. 

VBA Triggers ActiveX controls
VBA Triggers ActiveX controls

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:

VBA Properties of ActiveX controls
VBA Properties of ActiveX controls

Leave a comment

Your email address will not be published. Required fields are marked *

%d bloggers like this: