Hi there,
I have many sheets in a workbook. Each of these sheets are called slide8, slide11, slide12 etc. On the sheets there are graphs which need to be pasted onto a powerpoint presentation under the corresponding slide.
My code looks like:
Dim objPPT As Object
Dim objPrs As Object
Dim shtTemp As Worksheet
Dim chtTemp As ChartObject
Dim intSlide As Integer
Set objPPT = CreateObject("Powerpoint.application")
objPPT.Visible = True
objPPT.presentations.Open ThisWorkbook.Path & "\template.ppt"
For i = 1 To Sheets.Count
a = Mid(Sheets(i).Name, 6, Len(Sheets(i).Name) - 5)
objPPT.ActiveWindow.ViewType = 1
For Each shtTemp In ThisWorkbook.Worksheets
For Each chtTemp In shtTemp.ChartObjects
chtTemp.CopyPicture
objPPT.ActiveWindow.View.GotoSlide Index:=objPPT.presentations (1).Slides.Add(Index:=a, Layout:=1).SlideIndex
'
objPPT.ActiveWindow.View.Paste
Next
Next
Next i
Aplication.DisplayAlerts = False
objPPT.presentations(1).SaveAs Filename:=ThisWorkbook.Path & "\tester.ppt"
Aplication.DisplayAlerts = True
objPPT.Quit
Set objPrs = Nothing
Set objPPT = Nothing
However, I can not select the slide which I want the graph to be pasted on.
Can anyone help???