Treading new ground controlling PPT from Excel

earlyd

Well-known Member
Joined
Dec 10, 2002
Messages
1,199
In trying to have Excel create a Powerpoint slide, I get stuck on the line that attempts to build the slide...can someone tell me what I'm doing wrong in the last line below?


Dim PPApp As PowerPoint.Application
Dim PPPres As PowerPoint.presentation
Dim ppslide As PowerPoint.Slide

Set PPApp = CreateObject("powerpoint.Application.10")
Set PPPres = PPApp.Presentations.Add
PPApp.Activate
PPApp.ActiveWindow.View.GotoSlide Index:=ActivePresentation.Slides.Add(Index:=1, Layout:=ppLayoutTitle).SlideIndex
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Try the following:

<font face=Courier New><SPAN style="color:darkblue">Sub</SPAN> test()
<SPAN style="color:darkblue">Dim</SPAN> PPApp <SPAN style="color:darkblue">As</SPAN> <SPAN style="color:darkblue">Object</SPAN>, PPPres <SPAN style="color:darkblue">As</SPAN> <SPAN style="color:darkblue">Object</SPAN>, PPSlide <SPAN style="color:darkblue">As</SPAN> <SPAN style="color:darkblue">Object</SPAN>
<SPAN style="color:darkblue">Set</SPAN> PPApp = CreateObject("PowerPoint.Application")
<SPAN style="color:darkblue">Set</SPAN> PPPres = PPApp.Presentations.Add
<SPAN style="color:darkblue">Set</SPAN> PPSlide = PPPres.Slides.Add(Index:=1, Layout:=1)
PPApp.Visible = <SPAN style="color:darkblue">True</SPAN>
<SPAN style="color:darkblue">Set</SPAN> PPSlide = Nothing: <SPAN style="color:darkblue">Set</SPAN> PPPres = Nothing: <SPAN style="color:darkblue">Set</SPAN> PPApp = <SPAN style="color:darkblue">Nothing</SPAN>
<SPAN style="color:darkblue">End</SPAN> <SPAN style="color:darkblue">Sub</SPAN></FONT>
 
Upvote 0

Forum statistics

Threads
1,215,261
Messages
6,123,931
Members
449,134
Latest member
NickWBA

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