SUMMARY
<script type="text/javascript">loadTOCNode(1, 'summary');</script>
This article describes how to automate Microsoft PowerPoint by using Visual C++ 5.0 or Visual C++ 6.0 with The Microsoft Foundation Classes (MFC).
MORE INFORMATION
<script type="text/javascript">loadTOCNode(1, 'moreinformation');</script>
By using automation in PowerPoint, you can programmatically print, display slides, and do most of the things you can do interactively. Follow these steps to build and run the automation example:
1. | Create a new dialog-based MFC EXE project. |
2. | Add a button to your dialog box and a BN_CLICKED-handler for it. |
3. | Open ClassWizard (Ctrl+W), click the Automation tab, click Add Class, and select From a type library. |
4. | Go to the directory where you installed Office (for example, C:/Program Files/Microsoft Office/Office) and choose Msppt8.olb. The PowerPoint object library for PowerPoint 2000 is named Msppt9.olb. The PowerPoint object library for PowerPoint 2002 is Msppt.olb, and it is located, by default, in the c:/Program Files/Microsoft Office/Office10 folder. The PowerPoint object library for Microsoft Office PowerPoint 2003 is Msppt.olb, and it is located, by default, in the c:/Program Files/Microsoft Office/Office11 folder |
5. | Select all the classes it finds, and click OK to get back to your project. ClassWizard has generated some automation "wrapper classes" from the PowerPoint type library and created the files Msppt8.h and Msppt8.cpp. |
6. | Add the following code to your button handler: ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
7. | Add the following lines just before the implementing your button handler: |
8. | Compile and run. |
REFERENCES
<script type="text/javascript">loadTOCNode(1, 'references');</script>
For additional information about automating Microsoft Office applications from Visual C++, click the following article number to view the article in the Microsoft Knowledge Base:
196776
(http://support.microsoft.com/kb/196776/) Office Automation Using Visual C++