Microsoft Office 2000/Visual Basic Programmer's Guide |
When you write VBA code to work with PowerPoint, you begin with the Application object. If you are writing VBA code within PowerPoint, the Application object is created for you. If you are automating PowerPoint from some other application, you first create a PowerPoint Application object variable and then create an instance of PowerPoint. Unlike the other Office applications (except Outlook), there can be only one instance of PowerPoint running at a time. If an instance of PowerPoint is running and you use the New keyword or the CreateObject or GetObject function to instantiate a PowerPoint object variable, that object variable will point to the currently running instance of PowerPoint. This single instance of the Application object can contain any number of open Presentation objects. For more information about using the New keyword or the CreateObject and GetObject functions, see Chapter 4, "Understanding Office Objects and Object Models."
Microsoft PowerPoint's Application object has properties you can use to access shared Office components such as command bars and the Office Assistant. In addition, the Application object has properties that return the currently active presentation or window, or information about the printer. The PPTShowApplicationInfo procedure illustrates how you might use properties of the Application object. This procedure is available in the modPPTCode module in PowerPointTools.ppt in the ODETools\V9\Samples\OPG\Samples\CH05 subfolder on the Office 2000 Developer CD-ROM. Figure 5.4 displays the message box created by the PPTShowApplicationInfo procedure.
Figure 5.4 Information Returned by the PPTShowApplicationInfo Procedure