Automate PowerPoint Using Excel VBA – Is it possible?

Asked By 90 points N/A Posted on -
qa-featured
Hi,

I've been using macros in MSExcel for several months now and I know how powerful these macros are.

How can I use Excel as a host to open a PowerPoint presentation and then play on a certain slide number automatically?

Below is my attempt on how to do that:

Dim ppte As Object

Dim oPAe As PowerPoint.Application
Dim oPPe As PowerPoint.Presentation
Dim oPSe As PowerPoint.Slide
Dim oShapee As PowerPoint.Shape
Dim oPicturee As PowerPoint.Shape
 
With ppt      .Visible = True
    .Presentations.Open ("C:UsersUser2DocumentsMyPresentation.ppt")
End With
 
This is what I did to go to a specific slide:
 
ActiveWindow.View.GotoSlide 6
 
However, I get an run-time error (429). Any advice?
SHARE
Answered By 0 points N/A #108358

Automate PowerPoint Using Excel VBA – Is it possible?

qa-featured

Hi

This particular error (Runtime error 429) generally happens when you are trying to access a program that’s fail to complete the action and/or create the object that you requested.

More precisely this error is more common to happen when using VBA to connect with MS Office apps. (In your case, you used VBA to access to MS Power point).Your code was:

 Dim ppte As Object

 Dim oPAe As PowerPoint.Application

 Dim oPPe As PowerPoint.Presentation

 Dim oPSe As PowerPoint.Slide

 Dim oShapee As PowerPoint.Shape

 Dim oPicturee As PowerPoint.Shape

 With ppt      .Visible = True

     .Presentations.Open ("C:UsersUser2DocumentsMyPresentation.ppt")

 End With

 ActiveWindow.View.GotoSlide 6  // (this line that may caused the error) 

Try to use the code below (just add a point "." before  the line that caused the error):

With ppt      .Visible = True

     .Presentations.Open ("C:UsersUser2DocumentsMyPresentation.ppt")

     .ActiveWindow.View.GotoSlide 6

 End With 

Good Luck

Related Questions