Issue running PowerPoint through Excel

piratemonkey22

New Member
Joined
Jul 23, 2019
Messages
1
Hi,

I am having an issue whereby I wish to update a PPT template through Excel VBA on my Mac. I am able to open the template and save a copy of it no problem, however I am having a problem where I am unable to select objects on PPT slides to update without Excel crashing. Please see the below code which when executed gives the following error: 'Run-time error '429': ActiveX component can't create object'.

The code breaks at the highlighted line. In PPT I renamed the object to the name "TitleBox 1", which is what I am attempting to select. When I use the commented out line, Excel just completely crashes. Any advice on how to solve it would be very much appreciated or sources of information to look at to resolve this issue.



Sub Run_PPT()


Dim DestinationPPT As String
Dim Destination As String
Dim strName As String
Dim PowerPointApp As PowerPoint.Application
Dim myPresentation As PowerPoint.Presentation


'Applies a variable to the PPT Template to be used throughout the Macro. Also opens the PPT file.
Set PowerPointApp = CreateObject("PowerPoint.Application")
DestinationPPT = "/Users/xxxx/xxxx/Template.pptx"


Set myPresentation = PowerPointApp.Presentations.Open(DestinationPPT)


'Title Slide


'myPresentation.Slides(1).Shapes("TitleBox 2").Select
ActivePresentation.Slides(1).Shapes("TitleBox 2").Select








'Saves the ppt as a pdf
Destination = "/Users/xxxx/xxxx/"
strName = "Test"
myPresentation.SaveAs FileName:=Destination & strName & ".PDF", FileFormat:=ppSaveAsPDF
MsgBox "Saved as :" & DestinationPPT & "" & strName & ".PDF"






End Sub
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).

Forum statistics

Threads
1,223,886
Messages
6,175,196
Members
452,616
Latest member
intern444

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