Listing 8-8. Complete CreateTitleSlide Subroutine
Sub CreateTitleSlide()
Set m_oPptSlide = m_oPptShow.Slides.Add(1, ppLayoutTitle)
With m_oPptSlide.Shapes.Placeholders(1)
With .TextFrame.TextRange
.Text = GetTitle
.Font.Bold = msoTrue
.ChangeCase ppCaseUpper
End With
End With
With m_oPptSlide.Shapes.Placeholders(2)
With .TextFrame.TextRange
.Text = GetTitleBody
.Font.Bold = msoFalse
.ChangeCase ppCaseUpper
End With
End With
End Sub
Next, we??™ll create a procedure to add the slide charts.
1. Add a new subroutine to the code module we??™ve been working in. Name it
CreateChartSlides.
2. Add the following variable declarations to CreateChartSlides:
Dim i As Integer
Dim sTitle As String
Dim sngChartStart As Single
Dim spacer As Integer
The first variable, i, is the counter variable for the loop we??™ll use when enumerating
through our charts. sTitle will store the title text for each chart slide. The sngChartStart variable
will be used to help us determine where to place the chart on the slide and how to size it.
The last variable, spacer, will be used to put a bit of space between the title placeholder and
the chart.
CHAPTER 8 n OFFICE INTEGRATION 302
3. Add a For...Next loop with two blank lines between the start and end of the loop, as
follows:
For i = 1 To 3
Next i
The entire subroutine will take place within this For...Next block.
4. Add the following lines of code:
Worksheets(1).ChartObjects(i).Activate
sTitle = ActiveChart.ChartTitle.
Pages:
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283