Hey,
Somewhat new to VBA. Trying export specified excel graphs into PowerPoint slide. Through research and analysis, I have the code below. Which imports a range of the excel sheet into the PowerPoint slides. My issue is that i have a sheet with 10 other graphs and would need to export those as well not just one graph. And having hard time figuring out how to specify those ranges in the code so that each graph would be imported in to a new slide. Any help is much appreciated. Thanks in advance!!
Sub sbPowePoint_SendDataFromExcelToPPT()
'Declarations
Dim oPPT As PowerPoint.Application
Dim oPPres As PowerPoint.Presentation
Dim oPSlide As PowerPoint.Slide
Dim sText As String
'Open PowerPoint
Set oPPT = New PowerPoint.Application
Set oPPres = oPPT.Presentations.Add
oPPT.Visible = True
'Add a Slide
Set oPSlide = oPPres.Slides.Add(1, ppLayoutTitleOnly)
oPSlide.Select
'Copy a range as a picture and align it
ActiveSheet.Range("A1:B10").CopyPicture Appearance:=xlScreen, Format:=xlPicture
oPSlide.Shapes.Paste.Select
oPPT.ActiveWindow.Selection.ShapeRange.Align msoAlignCenters, True
oPPT.ActiveWindow.Selection.ShapeRange.Align msoAlignMiddles, True
'Add the title text
sText = "My Header"
oPSlide.Shapes.Title.TextFrame.TextRange.Text = sText
oPPT.Activate
'Release Objects
Set oPSlide = Nothing
Set oPPres = Nothing
Set oPPT = Nothing
End Sub
Bookmarks