The process will be very similar, although the
objects we will use will be very different.
CHAPTER 8 n OFFICE INTEGRATION 298
In this example, we will build a series of slides, including a title page followed by one slide
per chart in our Excel workbook project. The steps involved in this code will be as follows:
1. Open the PowerPoint application.
2. Create a new presentation document.
3. Create a Slide object.
4. Add a title slide.
5. Add chart slides.
6. Display the PowerPoint window with the new presentation loaded.
Coding the Presentation
Before we could access any of the Word DOM objects in the previous example, we had to add
a reference to the Word Object Model to our code project. Before we can access any of the
PowerPoint DOM objects, we must also add a reference to the PowerPoint Object Model.
1. Open the VBE by selecting the Developer ribbon ?¤ Code tab ?¤Visual Basic command,
or by pressing Alt+F11.
2. In the VBE, select Tools ?¤ References to display the References dialog box (shown in
Figure 8-8).
Figure 8-8. Adding a reference to the PowerPoint 12.0 Object Model
3. Select the Microsoft PowerPoint 12.0 Object Library.
4. Click OK to save the reference.
Now we can start coding against the PowerPoint DOM. For our PowerPoint example, we??™ll
use a new empty code module.
CHAPTER 8 n OFFICE INTEGRATION 299
5. In the VBE, add a new standard module in the Project Explorer. If you??™ve only coded
per the previous example, this should be Module3 (but don??™t worry if it??™s not).
Pages:
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280