I have a number of ranges in Excel that I'd like to copy and be able to paste into the same slide in an already created PPT presentation. With the below code that I've put together, for some reason only the first range is getting pasted into the slide and the second is either not pasting or getting deleted immediately after getting pasted into the slide. What am I doing wrong? Or is there maybe a better approach to copying multiple different ranges and pasting them into the same slide as separate pictures? Thanks in advance!
Code:
Sheets("Exec Summary").Activate
Range("E4:L20").Select
Selection.CopyPicture Appearance:=xlScreen, Format:=xlPicture
Set PowerPointApp = GetObject(class:="PowerPoint.Application")
Set myPresentation = PowerPointApp.ActivePresentation
For p = myPresentation.slides(7).Shapes.Count To 1 Step -1
Set ppShape = myPresentation.slides(7).Shapes(p)
If ppShape.Type = msoPicture Then ppShape.Delete
Next
With myPresentation.slides(7)
.Shapes.Paste
With .Shapes(.Shapes.Count)
.Left = 100
.Top = 125
.Height = 325
.Width = 500
End With
End With
Sheets("Exec Summary").Activate
Range("M20:P20").Select
Selection.CopyPicture Appearance:=xlScreen, Format:=xlPicture
With myPresentation.slides(7)
.Shapes.Paste
With .Shapes(.Shapes.Count)
.Left = 100
.Top = 525
.Height = 325
.Width = 500
End With
End With