The first is a counter for our loop through our charts and text indexes, and the second
will hold the title for each slide. The remaining variables will be used to hold the information
for the third of the three Placeholder objects on our slide template. We??™ll need them in
order to place the chart correctly on the slide.
4. Add the following empty For...Next block with one or two blank lines within the code
block:
For i = 1 To 3
Next i
5. Within the For...Next block, add the following code:
Worksheets(1).ChartObjects(i).Activate
sTitle = ActiveChart.ChartTitle.Text
Set m_oPptSlide = m_oPptShow.Slides.Add(i + 1, ppLayoutTextAndChart)
This code is almost identical to our previous example??”but notice the new layout type
enum, ppLayoutTextAndChart. This gives us the slide template shown in Figure 8-14.
6. Next (still within the For...Next loop), add the following With...End With block to the
CreateChartSlidesText subroutine:
With m_oPptSlide.Shapes.Placeholders(1)
With .TextFrame.TextRange
.Text = sTitle
End With
End With
Again, this code is very similar to our previous example, minus the variable to hold the
placeholder location (sngChartStart). In our current example, we already have a placeholder
for our chart, but we have to use a different technique to get its location.
7. Immediately below the With...End With block, add the following code:
With m_oPptSlide.Shapes.Placeholders(2)
With .TextFrame.TextRange
.Text = GetSubjectBody(i)
End With
End With
This code sets a reference to the second Placeholder object on our slide and inserts the
descriptive text from the GetSubjectBody function.
Pages:
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288