The code below worked. It creates a new PowerPoint object, then creates a
new presentation, then selects the second slide in the presentation.
Sub Control_PPT()
Dim PPTApp As PowerPoint.Application
Dim PPres As PowerPoint.Presentation
Dim theSlide As PowerPoint.Slide
'
Set PPTApp = New PowerPoint.Application ' Start up PowerPoint
PPTApp.Visible = msoTrue ' IMPORTANT: Make it
visible!
Set PPres = PPTApp.Presentations.Add ' Create a new presentation
object
PPres.Slides.Add Index:=PPres.Slides.Count + 1, Layout:=ppLayoutBlank
PPres.Slides.Add Index:=PPres.Slides.Count + 1, Layout:=ppLayoutBlank
PPres.Slides.Add Index:=PPres.Slides.Count + 1, Layout:=ppLayoutBlank
'
Set theSlide = PPres.Slides(2)
theSlide.Select
'
' Do other stuff here...
'
' Unload the PowerPoint stuff
'
Set theSlide = Nothing
Set PPres = Nothing
Set PPTApp = Nothing
'
End Sub
"Emma" wrote:
Hi
I've tried that in excel and I'm getting the error "Slides (Unknown member):
Invalid request". I've renamed the slide using a macro to "Units" and have
replaced the 2 in the code below with units
So...
Dim theSlide as PowerPoint.Slide
'
Set theSlide = PPres.Slides("Units")
theSlide.Select
I've also tried without the quotation marks around units. Any ideas?
Thanks
Emma
"EricG" wrote:
In PowerPoint it would be:
Dim theSlide As Slide
'
Set theSlide = ActivePresentation.Slides(2)
theSlide.Select
So in Excel, it should be:
Dim theSlide as PowerPoint.Slide
'
Set theSlide = PPres.Slides(2)
theSlide.Select
HTH,
Eric
"Emma" wrote:
I'm using Peltier's code from here
http://peltiertech.com/Excel/XL_PPT.html#rangeppt to link my excel worksheet
in with powerpoint.
I want to populate 4 slides from different selections in excel. The problem
I'm having is that I can't figure out the code to move onto the next PPT
slide.
I've tried all variations on this, and i've renamed the slides and replaced
the 2 with the appropriate name, but everytime i get a complie error at
select.
Set PPSlide = PPPres.Slides(2).Select
How can I activate the next slide?