Hi,
I'm trying to figure out how to get the loop below to work correctly so would appreciate any help.
Essentially the loop needs to look in each worksheet and if there's a '1' in cell S1 to then copy & paste the range 'Print_Area' into a blank PowerPoint slide with a slide for each instance.
The code below adds in the right number of sheets but only pastes the first worksheet into all the slides which I want to change so that each instance has its own slide.
Thanks in advance for any help.
I'm trying to figure out how to get the loop below to work correctly so would appreciate any help.
Essentially the loop needs to look in each worksheet and if there's a '1' in cell S1 to then copy & paste the range 'Print_Area' into a blank PowerPoint slide with a slide for each instance.
The code below adds in the right number of sheets but only pastes the first worksheet into all the slides which I want to change so that each instance has its own slide.
Thanks in advance for any help.
Code:
'Create a New Presentation
Set myPresentation = PowerPointApp.Presentations.Add
'Loop through each chart in the Excel worksheet and paste them into the PowerPoint
For Each ws In ActiveWorkbook.Worksheets
If ws.Range("S1") = "1" Then
'Add a slide to the Presentation
Set mySlide = myPresentation.Slides.Add(1, ppLayoutBlank) '11 = ppLayoutTitleOnly
'Copy Excel Range
rng.Copy
'Paste to PowerPoint and position
mySlide.Shapes.PasteSpecial DataType:=10 '2 = ppPasteEnhancedMetafile
Set myShape = mySlide.Shapes(mySlide.Shapes.Count)
'Set position:
myShape.Left = 15
myShape.Top = 15
myShape.Width = 690
End If
Next ws