[ Team LiB ] Previous Section Next Section

Assigning a Macro to an Event

An event is a specific action that occurs on or with a certain object. Clicking a button is an event, called the Click event. The Click event in this case occurs on the button object. Other events include the Dbl Click event (for double-clicking) and the On Enter event, which occurs, for example, when a user "enters" a field by clicking it. If you want to run a macro in response to an event, you have to work in the object's property sheet. The property sheet lists all of the events applicable to the object. You can choose the event and then specify the macro that will run when it occurs, or create a new macro in the Macro window.

Assign a Macro to an Event

graphics/1_icon.jpg

In Design view, double-click the object in which the event will occur.

graphics/2_icon.jpg

Click the Event tab.

graphics/3_icon.jpg

Click the box for the event you want to use.

graphics/4_icon.jpg

Click the list arrow, and then click the macro you want to use.

graphics/5_icon.jpg

Click the Close button on the Properties window.

graphics/13inf18.jpg

Create a New Macro for an Event

graphics/1_icon.jpg

In Design view, double-click the object.

graphics/2_icon.jpg

Click the Event tab.

graphics/3_icon.jpg

Click the specific event to which you want to assign the macro.

graphics/4_icon.jpg

Click the Build button.

graphics/5_icon.jpg

Click Macro Builder.

graphics/6_icon.jpg

Click OK.

graphics/7_icon.jpg

Enter a name for the new macro, and then click OK.

graphics/8_icon.jpg

Enter the actions for the new macro, and then close the Macro window.

graphics/9_icon.jpg

Click the Close button on the Properties window.

graphics/13inf19.jpg

    [ Team LiB ] Previous Section Next Section