I am trying to do something very simple but running into a problem with pasting. I am a VBA novice. Please see the code below. I have the reference to Microsoft PowerPoint Object library set up. Everything works util the paste step.
Sub PowerPoint()
'creates new instance of powerpoint
Dim ppApp As Object
Dim ppPres As PowerPoint.Presentation
Dim ppSlide As PowerPoint.Slide
Set ppApp = CreateObject("PowerPoint.Application")
ppApp.Visible = True
ppApp.Activate
'cretae presentation
Set ppPres = ppApp.Presentations.Add
Set ppSlide = ppPres.Slides.Add(1, ppLayoutTitle)
ppSlide.Shapes(1).TextFrame.TextRange = "Title"
ppSlide.Shapes(2).TextFrame.TextRange = "by First Last"
Set ppSlide = ppPres.Slides.Add(2, ppLayoutBlank)
ppSlide.Select
Range("C3:H8").Copy
ppSlide.Shapes.Paste
End Sub
Sub PowerPoint()
'creates new instance of powerpoint
Dim ppApp As Object
Dim ppPres As PowerPoint.Presentation
Dim ppSlide As PowerPoint.Slide
Set ppApp = CreateObject("PowerPoint.Application")
ppApp.Visible = True
ppApp.Activate
'cretae presentation
Set ppPres = ppApp.Presentations.Add
Set ppSlide = ppPres.Slides.Add(1, ppLayoutTitle)
ppSlide.Shapes(1).TextFrame.TextRange = "Title"
ppSlide.Shapes(2).TextFrame.TextRange = "by First Last"
Set ppSlide = ppPres.Slides.Add(2, ppLayoutBlank)
ppSlide.Select
Range("C3:H8").Copy
ppSlide.Shapes.Paste
End Sub