I found a great starting point from http://peltiertech.com/Excel/XL_PPT.html which "Paste a Selected Excel Worksheet Range into the Active PowerPoint Slide" but it uses one selected range and pastes it to one PowerPoint page.
I want to use multiple Excel ranges and paste each one to a new slide in PowerPoint. For example, I want to create a new PPT, paste Excel range "TableA" to PPT slide 1, then paste Excel range "TableB" to PPT slide 2, etc. Each range would be pasted in the center of the PPT slide.
Here's the starter code from the website above:
******************************************************
Sub RangeToPresentation()
' Set a VBE reference to Microsoft PowerPoint Object Library
Dim PPApp As PowerPoint.Application
Dim PPPres As PowerPoint.Presentation
Dim PPSlide As PowerPoint.Slide
' Make sure a range is selected
If Not TypeName(Selection) = "Range" Then
MsgBox "Please select a worksheet range and try again.", vbExclamation, _
"No Range Selected"
Else
' Reference existing instance of PowerPoint
Set PPApp = GetObject(, "Powerpoint.Application")
' Reference active presentation
Set PPPres = PPApp.ActivePresentation
PPApp.ActiveWindow.ViewType = ppViewSlide
' Reference active slide
Set PPSlide = PPPres.Slides(PPApp.ActiveWindow.Selection.SlideRange.SlideIndex)
' Copy the range as a piicture
Selection.CopyPicture Appearance:=xlScreen, _
Format:=xlPicture
' Paste the range
PPSlide.Shapes.Paste.Select
' Align the pasted range
PPApp.ActiveWindow.Selection.ShapeRange.Align msoAlignCenters, True
PPApp.ActiveWindow.Selection.ShapeRange.Align msoAlignMiddles, True
' Clean up
Set PPSlide = Nothing
Set PPPres = Nothing
Set PPApp = Nothing
End If
End Sub
*****************************************************
Never mind. I finally solved this one myself...
Bookmarks