How to: Use ActiveX Controls on Slides
|PowerPoint Developer Reference|
You can add controls to your slides to provide a sophisticated way to exchange information with the user while a slide show is running. For example, you could use controls on slides to allow viewers of a show designed to be run in a kiosk a way to choose options and then run a custom show based on the viewer's choices.
Keep the following points in mind when you are working with controls on slides.
- A control on a slide is in design mode except when the slide show is running.
- If you want a control to appear on all slides in a presentation, add it to the slide master.
- The Me keyword in an event procedure for a control on a slide refers to the slide, not the control.
Writing event code for controls on slides is very similar to writing event code for controls on forms. The following procedure sets the background for the slide the button named "cmdChangeColor" is on when the button is clicked.
You may want to use controls to provide your slide show with navigation tools that are more complex than those built into Microsoft Office PowerPoint. For example, if you add two buttons named "cmdBack" and "cmdForward" to the slide master and write the following code behind them, all slides based on the master (and set to show master background graphics) will have these professional-looking navigation buttons that will be active during a slide show.
To work with all the ActiveX controls on a slide without affecting the other shapes on the slide, you can construct a ShapeRange collection that contains only controls. You can then apply properties and methods to the entire collection or iterate through the collection to work with each control individually. The following example aligns all the controls on slide one in the active presentation and distributes them vertically.
- Control and dialog box events
- 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 Control Values while Code is Running