I have an Excel Workbook with Data in A1:D16 on each worksheet in the workbook, that I want to export to PowerPoint, the data is a mini financial statement (No charts, not table, just numbers). When I run the script I get a Run-time error '424': Object Required Can you tell me what is wrong?
Sub ExportRangeToPowerPoint()
'Declare PowerPoint Object Variables
Dim PPTApp As PowerPoint.Application
Dim PPTPres As PowerPoint.Presentation
Dim PPTSlide As PowerPoint.Slide
'Declare Excel Object Variable
Dim ExcRng As Range
'Create a new instance of PowerPoint
Set PPTApp = New PowerPoint.Application
PPTApp.Visible = True
'Create a new Presentation within the Application
Set PPTPres = PPTApp.Presentations.Add
'Create a new slide within the presentation
Set PPTSlide = PPTPres.Slides.Add(1, ppLayoutTitleOnly)
'Create a reference to the Excel Range we want to Export
Set ExcRng = Range("A1:D16")
'Copy the range
ExcRng.Copy
'Paste the range in the slide
PPPTSlide.Shapes.Paste
End Sub
Sub ExportRangeToPowerPoint()
'Declare PowerPoint Object Variables
Dim PPTApp As PowerPoint.Application
Dim PPTPres As PowerPoint.Presentation
Dim PPTSlide As PowerPoint.Slide
'Declare Excel Object Variable
Dim ExcRng As Range
'Create a new instance of PowerPoint
Set PPTApp = New PowerPoint.Application
PPTApp.Visible = True
'Create a new Presentation within the Application
Set PPTPres = PPTApp.Presentations.Add
'Create a new slide within the presentation
Set PPTSlide = PPTPres.Slides.Add(1, ppLayoutTitleOnly)
'Create a reference to the Excel Range we want to Export
Set ExcRng = Range("A1:D16")
'Copy the range
ExcRng.Copy
'Paste the range in the slide
PPPTSlide.Shapes.Paste
End Sub