In VBA Excel, additional controls are not shown by default because they are not part of the core set of controls available in the Excel development environment. The Excel development environment includes a set of built-in controls that are commonly used for creating user interfaces in Excel applications, such as buttons, text boxes, and drop-down lists.
However, VBA allows you to add additional controls called ActiveX controls to your Excel worksheets or user forms, which provide more advanced functionalities and visual elements. These ActiveX controls can be used to create custom interfaces with features like calendars, sliders, or custom-designed buttons.
To add additional controls in VBA Excel, follow these steps:
- Open the VBA editor by pressing Alt + F11 in Excel.
- In the VBA editor, select the worksheet or user form where you want to add the control. If you want to add the control to a specific worksheet, you need to double-click on the worksheet name in the “Project Explorer” window. If you want to add the control to a user form, you need to double-click on the user form name in the “Project Explorer” window.
- In the “Toolbox” window, right-click and select “Additional Controls” from the context menu.
- In the “Additional Controls” dialog box, check the checkboxes corresponding to the controls you want to add. Some common examples of additional controls are “Calendar Control”, “Slider Control”, and “Image Control”.
- Click “OK” to close the dialog box.
- Now, you should see the additional controls in the “Toolbox” window. You can click and drag them onto your worksheet or user form.
Once you have added an additional control to your worksheet or user form, you can interact with it using VBA code. For example, you can change its properties programmatically, handle its events, or retrieve its current state or value. The specific code required will depend on the type of control you are using.
It’s worth noting that ActiveX controls may require additional licensing or security settings, and they might not be available in all versions of Excel or on all operating systems. Therefore, if you plan to distribute your Excel application to other users, it’s important to consider these factors and test your application on different environments.