In the previous example, we called on the Add method of the Slides collection using the
following code:
Set m_oPptSlide = m_oPptShow.Slides.Add(i + 1, ppLayoutTitleOnly)
CHAPTER 8 n OFFICE INTEGRATION 307
The layout type we used was ppLayoutTitleOnly, which gave us an empty slide with a
Placeholder object to hold our title text. We used the remainder of the slide, which was
empty, to place and size our chart. In our next example, we??™ll change the layout type to one
that includes three placeholders: one for the title, one for the descriptive text, and one for the
chart itself.
Adding Text to the Chart Slides
In this example, we??™ll use a different slide template for our text and chart. Figure 8-14 shows
the empty template slide in PowerPoint.
Figure 8-14. PowerPoint slide template for text and chart
Let??™s begin coding the CreateChartSlidesText procedure. In it we will add the title text in
the title placeholder. We??™ll put our descriptive text in the text placeholder on the left side of the
slide. Finally, we??™ll place our chart in the chart placeholder on the right side of the slide.
1. Open the VBE by selecting the Developer ribbon ?¤ Code tab ?¤Visual Basic command,
or press by Alt+F11.
2. On the standard module containing the PowerPoint code you??™ve been working on,
create a new subroutine and name it CreateChartSlidesText.
3. Add the following variable declarations:
Dim i As Integer
Dim sTitle As String
Dim oShape As PowerPoint.Shape
Dim top As Integer
Dim left As Integer
Dim height As Integer
Dim width As Integer
CHAPTER 8 n OFFICE INTEGRATION 308
The first two variables, i and sTitle, serve the same function that they did in our original
example.
Pages:
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287