OliverBrain
New Member
- Joined
- Mar 19, 2015
- Messages
- 30
I am trying to use pastespecial in some code I am writing to copy data from excel to powerpoint. It is not working, any ideas why this might be?
The code I am writing:
Thanks!
The code I am writing:
Code:
Sub CreateNewPres()
'This Sub simply activates Powerpoint
Dim ppApp As PowerPoint.Application
Dim ppPres As PowerPoint.Presentation
Dim ppSlide As PowerPoint.Slide
Set ppApp = New PowerPoint.Application
ppApp.Visible = True
ppApp.Activate
Set ppPres = ppApp.Presentations.Add
Set ppSlide = ppPres.Slides.Add(1, ppLayoutTitle)
'now refer to the shapes within the title slide and input what you want
ppSlide.Shapes(1).TextFrame.TextRange = "End of Pilot Presentation"
ppSlide.Shapes(2).TextFrame.TextRange = "Client Name"
'Add new slide
Set ppSlide = ppPres.Slides.Add(2, ppLayoutBlank)
ppSlide.Select
'this just selects the last slide that you created
'next step is to copy data from excel to the slide that you just created
Range("a1:j32").Copy
ppSlide.Shapes.PasteSpecial
ppSlide.Shapes(1).IncrementLeft -100
'can set it to the width of the slide i.e. width = ppPres.PageSetup.SlideWidth
End Sub
Thanks!
Last edited by a moderator: