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 278 | Next

Jim DeMarco

"Pro Excel 2007 VBA"


nNote You might notice that although we??™re retrieving and holding a reference to the height of the placeholder
shape, we??™re not using it when we place the chart. It??™s included here for reference. If you need to
resize the height in your projects, this is how and where you??™d do it.
That??™s it for coding our For...Next loop.
11. Place the insertion point at the end of the loop and press Enter.
12. Add the following line of cleanup code:
Set oShape = Nothing
Once we??™re done with it, we destroy the oShape object. That??™s the last line of code in this
procedure. The finished CreateChartSlidesText subroutine should look like Listing 8-12.
CHAPTER 8 n OFFICE INTEGRATION 310
Listing 8-12. Complete CreateChartSlidesText Subroutine
Sub CreateChartSlidesText()
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
For i = 1 To 3
Worksheets(1).ChartObjects(i).Activate
sTitle = ActiveChart.ChartTitle.Text
Set m_oPptSlide = m_oPptShow.Slides.Add(i + 1, ppLayoutTextAndChart)
With m_oPptSlide.Shapes.Placeholders(1)
With .TextFrame.TextRange
.Text = sTitle
End With
End With
With m_oPptSlide.Shapes.Placeholders(2)
With .TextFrame.TextRange
.Text = GetSubjectBody(i)
End With
End With
Worksheets(1).ChartObjects(i).Copy
Set oShape = m_oPptSlide.Shapes(3)
With oShape
top = .Top
left = .Left
width = .Width
height = .Height
.Delete
End With
With m_oPptSlide.


Pages:
266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290