Control and dialog box events
|PowerPoint Developer Reference|
After you add controls to your dialog box or document, you add event procedures to determine how the controls respond to user actions.
UserForms and controls have a predefined set of events. For example, a command button has a Click event that occurs when the user clicks the command button, and UserForms have an Initialize event that runs when the form is loaded.
To write a control or form event procedure, open a module by double-clicking the form or control, and select the event from the Procedure drop-down list box.
Event procedures include the name of the control. For example, the name of the Click event procedure for a command button named Command1 is Command1_Click.
If you add code to an event procedure and then change the name of the control, your code remains in procedures with the previous name.
For example, assume you add code to the Click event for Commmand1 and then rename the control to Command2. When you double-click Command2, you will not see any code in the Click event procedure. You will need to move code from Command1_Click to Command2_Click.
To simplify development, it is a good practice to name your controls before writing code.
- How to: Add Controls to Documents
- How to: Add Controls to UserForms
- How to: Create Custom Dialog Boxes
- How to: Create UserForms
- How to: Display Custom Dialog Boxes
- How to: Initialize Control Properties
- How to: Set Control Properties
- How to: Use ActiveX Controls on Documents
- How to: Use ActiveX Controls on Slides
- How to: Use Control Values while Code is Running