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
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
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...
 
Upvote 0
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!
 
Upvote 0
Nice to be able to help out a bit, rather than just receiving help all the time. Glad it worked for you. :)
 
Upvote 0

Forum statistics

Threads
1,214,650
Messages
6,120,736
Members
448,988
Latest member
BB_Unlv

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top