A.24. Chapter 24: Understanding the Powerpoint Object Model and Key Objects

Understand PowerPoint's creatable objects Creatable objects are commonly used objects that can be employed in VBA code without requiring that you qualify them with the Application object. You can leave that word out of your code; it's optional, and rarely used.

Master It Name one of the objects or collections that are creatable in PowerPoint procedures.

Solution Objects or collections that are creatable in PowerPoint procedures include the ActivePresentation object, the Presentations collection, the ActiveWindow object, and the SlideShowWindows collection.

Work with presentations You can create a new presentation programmatically, but PowerPoint generates a flicker on most systems while it brings the new presentation into view. You can prevent this startling effect that might disturb some users.

Master It How do you prevent a newly created presentation from being visible so that you can create and manipulate it in your code without the user seeing the flickering effect on screen?

Solution WithWindow is an optional Long argument of the Add method of the Presentations collection. Set WithWindow to msoFalse to hide the presentation so that the user doesn't have to endure the irritating flickering effect that PowerPoint tends to exhibit while creating presentation objects programmatically. The default value is msoTrue, making the new presentation visible.

Work with windows and views To get the PowerPoint window into the state you want, you'll often need to work with the window and with the view.

Master It PowerPoint uses two types of windows. What are they?

Solution PowerPoint uses document windows and slide show windows.

Work with slides Once you have created or opened the presentation you want to affect, you can access the slides it contains by using the Slides collection, which contains a Slide object for each slide in the presentation. Each slide is identified by its index number, but you can also use object variables to refer to slides or assign names to slides.

Master It Why would you want to assign names to slides, rather than using the default index numbers that are automatically assigned to the slides?

Solution Assigning names to slides is useful because if you add slides to, or delete them from, the presentation, the index numbers of the slides will change. You don't want to have to keep track of these readjusted index numbers as you manipulate the collection. If they have names, you can access the slides directly, without worrying that their index numbers might have changed.

Work with masters Before attempting to manipulate a master in your code, you should determine whether the master actually exists in the presentation.

Master It How do you find out whether a presentation has a title master?

Solution Check the HasTitleMaster property. If the presentation already has a title master, VBA returns an error when you try to add a title master. So first check, like this:

If ActivePresentation.HasTitleMaster Then
        'take further action based on the If...Then test
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.128.186.158