SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 270 | Next

Jim DeMarco

"Pro Excel 2007 VBA"

The Slides collection??™s Add method adds a slide to the
collection and returns a Slide object back. Here we are assigning that new slide to our
m_oPptSlide variable.
The Add method takes two parameters. The first is the slide index. This tells PowerPoint
where to put the slide. In our code, it??™s set to 1 since we??™re creating the first or title slide. The
second parameter is the type of auto-layout to use. Figure 8-9 uses the Object Browser to show
the many options available.
CHAPTER 8 n OFFICE INTEGRATION 300
Figure 8-9. Slide layout enums listed in the Object Browser
The enum we??™ve used represents a layout with a title placeholder and a text placeholder.
3. Add the following code to the CreateTitleSlide subroutine:
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
CHAPTER 8 n OFFICE INTEGRATION 301
Within these two With...End With blocks, we are adding our title text and descriptive
text to the Placeholder objects on the title slide. In the first With...End With block, we are
setting the title and adding bold formatting to the text. In the second With...End With block,
we are adding the title body (or descriptive) text with no bold formatting. The completed
CreateTitleSlide subroutine should look like the code in Listing 8-8.


Pages:
258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282