Thank you John
Thank you John Wilson. Your method worked and positioned the chart on the page perfectly.
One more question if you know? The Title of the chart is positioned at the bottom of the page and the Title itself is left as "Click to add title". Do you know another method to position the title correctly at the top? Perhaps this is another change from Office 2003 to Office 2007? Any tips are appreciated.
Sub UpdateGraph()
Dim SheetNum As Integer
SheetNum = ActiveWorkbook.Worksheets.Count
Dim PPapt As PowerPoint.Application
Dim PPpres As PowerPoint.Presentation
Dim rngNewRange As Excel.Range
Dim Sh As Shape
Set oPPTApp = CreateObject("PowerPoint.Application")
oPPTApp.Visible = msoTrue
Set PPpres = oPPTApp.Presentations.Open("C:\Presentation1.ppt")
Dim SubclassArray(100, 2) As String
For y% = 1 To 99
SubclassArray(y%, 1) = Worksheets("List").Cells(y% + 2, 5).Value
SubclassArray(y%, 2) = Worksheets("List").Cells(y% + 2, 6).Value
Next
For x% = 1 To 100
Worksheets("OUT").Activate
Worksheets("OUT").Range("D2").Value = SubclassArray(x%, 2)
Set rngNewRange = Worksheets("OUT").Range("B2:L41")
rngNewRange.Select
rngNewRange.Copy
With PPpres.Slides(x%).Shapes.PasteSpecial(ppPasteEnhan cedMetafile)
.Height = 410
.Width = 630
.Left = 40
.Top = 75
End With
' PPpres.Slides(x%).Shapes.PasteSpecial ppPasteEnhancedMetafile
' PPpres.Slides(x%).Shapes(2).Height = 450
' PPpres.Slides(x%).Shapes(2).Width = 654
' PPpres.Slides(x%).Shapes(2).Left = 60
' PPpres.Slides(x%).Shapes(2).Top = 100
Dim HeaderText As String
HeaderText = "Class: " & SubclassArray(x%, 1)
PPpres.Slides(x%).Shapes(1).TextFrame.TextRange.Te xt = HeaderText
Next
End Sub
|