Skip to content

Latest commit

 

History

History
25 lines (18 loc) · 1.49 KB

control-and-dialog-box-events-powerpoint.md

File metadata and controls

25 lines (18 loc) · 1.49 KB
title keywords f1_keywords ms.assetid ms.date ms.localizationpriority
Control and Dialog Box Events (PowerPoint)
vbapp10.chm5192314
vbapp10.chm5192314
8fc4cece-05e3-3b03-9d6b-5a7bf4fa8a26
06/08/2019
high

Control and Dialog Box Events (PowerPoint)

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 Command1 and then rename the control to Command2. When you double-click Command2, you'll not see any code in the Click event procedure. You'll 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.

[!includeSupport and feedback]