tiredofit
Well-known Member
- Joined
- Apr 11, 2013
- Messages
- 1,926
- Office Version
- 365
- 2019
- Platform
- Windows
I am trying to control Powerpoint from Excel by following this video:
This is the code:
It works in the video but fails for me on this line:
with the message:
What is wrong?
The only difference is I'm using Excel 2010, the video is Excel 2013.
Thanks
Rich (BB code):
This is the code:
Rich (BB code):
Option Explicit
Sub Start()
Dim ppApp As PowerPoint.Application
Dim ppPres As PowerPoint.Presentation
Dim ppSlide As PowerPoint.Slide
Set ppApp = New PowerPoint.Application
ppApp.Visible = msoTrue
ppApp.Activate
Set ppPres = ppApp.Presentations.Add
Set ppSlide = ppPres.Slides.Add(1, ppLayoutTitle)
ppSlide.Shapes(1).TextFrame.TextRange = "Work"
ppSlide.Shapes(2).TextFrame.TextRange = "Some work"
Set ppSlide = ppPres.Slides.Add(2, ppLayoutBlank)
ppSlide.Select
Range("A1").CurrentRegion.Copy
ppSlide.Shapes.Paste
End Sub
It works in the video but fails for me on this line:
Rich (BB code):
ppSlide.Shapes.Paste
with the message:
Rich (BB code):
Run-timeerror '-2147188160 (80048240)':
Method 'Paste' of object 'Shapes' failed
What is wrong?
The only difference is I'm using Excel 2010, the video is Excel 2013.
Thanks