10.1 The PowerPoint object model

The PowerPoint object model

Like the other Office programs, PowerPoint s top-level object is the Application object, which stores the application-wide settings and options (size of main window, active printer, and so on). The Application object also provides access to all other objects in PowerPoint.

The primary object in PowerPoint is the Presentation object, which represents a single slide show presentation. A Presentation object corresponds to a PowerPoint file (PPT); PowerPoint users also refer to the PowerPoint file as a "presentation." (The term "presentation" is used in several ways in the Help files and other documentation; be sure you understand the context in which it s used, which can be difficult at 2:30 in the morning!)

The PowerPoint Application object keeps track of all open Presentation objects in the Presentations collection. Each Presentation object stores some default characteristics for the presentation. The SlideMaster object controls the default appearance of each slide object, and it manages such features as the slide background, color scheme, text styles, and headers and footers. Also available are objects that set the defaults for the print formats for notes and handouts, appropriately called NotesMaster and HandoutMaster. The SlideShowSettings object stores such information as what slide to start and end on, how to advance the slides, and whether or not to run a continuous loop. The Application s ActivePresentation property points to the active Presentation object.

Within each presentation is a Slides collection, which contains a Slide object for each slide in the presentation. Anything added to the slide text, bitmaps, shapes, lines, and so forth is stored in the Shapes collection. This concept is a little awkward at first, since it doesn t seem intuitive that text, lines, and bitmaps should be stored in the same collection wouldn t the average database developer normalize these into separate tables? It helps if you define a "shape" as something with size (height, width), colors (borders, background, foreground; perhaps even a bitmap), and a text element (which isn t always used). So how do you tell all these shapes apart? The Type property contains a number describing the shape. You can also use the Name property to attach a meaningful name, much as you would name each control placed on a FoxPro form.

There are several Range objects. You can group any number of slides into a SlideRange collection object, and any number of shapes into a ShapeRange collection object. By referencing a collection of slides or objects, you can easily set the properties of all elements in the collection.

PowerPoint Visual Basic Help contains a diagram of PowerPoint s object model. (See Chapter 2, "The Office Servers," for details on how to find this Help and what to do if you can t find it.) The figure is "live" when you click on an object, you re taken to the Help topic for that object. Figure 1 shows the portion of the object model diagram that describes the Presentation object.

 

Copyright 2000 by Tamar E. Granor and Della Martin All Rights Reserved



Microsoft Office Automation with Visual FoxPro
Microsoft Office Automation with Visual FoxPro
ISBN: 0965509303
EAN: 2147483647
Year: 2000
Pages: 128

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net