When adding controls to a userform, you probably find yourself often applying the same settings. You know it’s redundant, but what else can you do? You can customize a control and add it to the Control Toolbox so it’s always available. If that solution sounds way over your head, don’t worry—you will be amazed at how simple this enhancement is. In a nutshell, you simply drag a custom control from the userform to the Control Toolbox. That’s it!
Now, let’s work through a simple example. You’ll customize a command button by adding the text OK. To get started, open the VB Editor in Word or Excel and then complete the following steps:
- From the Insert menu, choose UserForm. Doing so will insert a blank userform and launch the Toolbox. If the editor fails to launch the Toolbox, choose Toolbox from the View menu.
- Drag a command button to the userform.
- Replace the generic text CommandButton1 with the text OK. (If the Toolbox disappears, click anywhere inside the userform.)
- Drag the modified command button from the userform to the Toolbox and release the mouse button to drop it right onto the Toolbox. The VB Editor adds it to the Toolbox.
At this point, you can’t tell the difference between the original generic command button and the custom button you added. You can easily remedy this by adding a Tool Tip to the custom button, as follows:
- Right-click your custom command button and choose Customize New CommandButton from the resulting context menu.
- In the Customize Control dialog box, replace New CommandButton in the Tool Tip Text control with the text OK.
- Click OK.
When you hover over the custom control, the Tool Tip will identify it—in this way you can easily differentiate between generic and custom controls.
Most of your custom controls will contain many more settings than this simple button example. By reducing the steps to set up these buttons, you can save a lot of time.