pliskers
Active Member
- Joined
- Sep 26, 2002
- Messages
- 462
- Office Version
- 2016
- Platform
- Windows
I am using some code to paste images of Excel sheets into PowerPoint. All works fine until the code encounters a sheet that also contains a graph. When it reaches the code to paste, I get an error message.
Here's a snippet of the code for a sample sheet:
Sheets("P20_9. Inc.Tax").Select
Range("P20_9").Activate
ActiveSheet.Outline.ShowLevels RowLevels:=1
ActiveSheet.Outline.ShowLevels RowLevels:=0, ColumnLevels:=1
' Copy the range as a picture
Selection.CopyPicture Appearance:=xlScreen, _
Format:=xlPicture
' Initialize PowerPoint Object Library
Set PPApp = GetObject(, "Powerpoint.Application")
' Reference active presentation
Set ppPres = PPApp.ActivePresentation
' Denote slide where range is to be copied and paste image
Set PPSlide = ppPres.Slides(20).Shapes.Paste
Is there an alternate code that I can use to capture BOTH the graph and the other data in the sheet and paste them as a single image to PowerPoint?
Here's a snippet of the code for a sample sheet:
Sheets("P20_9. Inc.Tax").Select
Range("P20_9").Activate
ActiveSheet.Outline.ShowLevels RowLevels:=1
ActiveSheet.Outline.ShowLevels RowLevels:=0, ColumnLevels:=1
' Copy the range as a picture
Selection.CopyPicture Appearance:=xlScreen, _
Format:=xlPicture
' Initialize PowerPoint Object Library
Set PPApp = GetObject(, "Powerpoint.Application")
' Reference active presentation
Set ppPres = PPApp.ActivePresentation
' Denote slide where range is to be copied and paste image
Set PPSlide = ppPres.Slides(20).Shapes.Paste
Is there an alternate code that I can use to capture BOTH the graph and the other data in the sheet and paste them as a single image to PowerPoint?