3 4
For special situations, you might want to use an ActiveX control to carry out actions when your user selects an item on your form. You might use an ActiveX control, for example, to run a macro that automates a task. In order to use ActiveX controls, you should be comfortable with Microsoft Visual Basic for Applications (VBA) or Microsoft Script Editor. To add an ActiveX control to your form, follow these steps:
Figure 36-17. When you add an ActiveX control to your form, Word changes to Design Mode.
Note
You can change the way the control appears by modifying the control's properties. Right-click the control to display the shortcut menu; then choose Properties. The Properties dialog box appears, as Figure 36-18 shows.
Figure 36-18. Change the way a control looks by making changes in the Properties dialog box.
Click the Categorized tab to see the various properties organized by category. If you want to make a change—for example, you might change the Font—double-click the setting in the right column. When you double-click the font selection, the Font dialog box appears so that you can make the necessary changes and click OK.
Although an in-depth discussion of using VBA to program a control is beyond the scope of this chapter, you can easily access the code window for scripting from your form. To access the code window, follow these steps:
Figure 36-19. When you click View Code, the Visual Basic window opens so that you can enter the script for the control.