Open Powerpoint presentation from Excel

VorLag

Board Regular
Joined
May 13, 2013
Messages
205
I have a macro that copies tables and images from my Excel workbook and pastes them as images into powerpoint. All I want to do is add something to actually open the powerpoint presentation from Excel, but I am getting an error that says "ActiveX cannot create the object". Can anyone tell me what I need to add or do to make this work?

Code:
    Dim PPApp  As PowerPoint.Application
    Dim PPPres As PowerPoint.Presentation
    Dim PPSlide As PowerPoint.Slide
Presentations.Open Filename:="C:\My Documents\pres1.pptm", ReadOnly:=msoFalse
 

Some videos you may like

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK

Kentetsu

Well-known Member
Joined
Jan 22, 2004
Messages
520
Google brought me this:

To open a PPT presentation by running code in Excel, you need to do four
things - add a reference to the powerpoint object model, boot powerpoint,
make powerpoint visible, and then open the file you want.

To add the reference:
Open VBE (Alt F11)
Tools / References
Scan down for "Microsoft Powerpoint <version> Object Library"
Check the box
Click OK

Once you've added the reference, the following code should do what you want:

Private Sub Business_Plan_Change()
Dim PPT As PowerPoint.Application
Set PPT = New PowerPoint.Application
PPT.Visible = True
PPT.Presentations.Open Filename:="F:\Reports\" & Business_Plan.Value &
".ppt"
End Sub

Hope that helps.

- Andy Tischaefer
Test Lead, Microsoft Office


Hopefully that will get you started in the right direction...
 

VorLag

Board Regular
Joined
May 13, 2013
Messages
205
Google brought me this:

To open a PPT presentation by running code in Excel, you need to do four
things - add a reference to the powerpoint object model, boot powerpoint,
make powerpoint visible, and then open the file you want.
...

This works! Thanks!
 

Kentetsu

Well-known Member
Joined
Jan 22, 2004
Messages
520
Nice to be able to help out a bit, rather than just receiving help all the time. Glad it worked for you. :)
 

Watch MrExcel Video

Forum statistics

Threads
1,108,816
Messages
5,525,058
Members
409,617
Latest member
Lenaf

This Week's Hot Topics

Top