Automating PP from Excel (both XP)

J

Jan Kronsell

I like to create a new PP presentation, add a new slide and then paste
something into that slide. But for some reason I can't get it to aded the
slide. It creates the presentation Ok, but never adds a slide and therefore
do not pastre anything: What am I doing wrong. This is my code so far:

Dim ppApp As Object

On Error Resume Next
Set ppApp = GetObject(, "powerpoint.application")

If Err.Number <> 0 Then
Set ppApp = CreateObject("powerpoint.Application")
End If

ppApp.Presentations.Add WithWindow:=msoTrue
ppApp.Activate
ppApp.ActiveWindow.View.GotoSlide
Index:=ActivePresentation.Slides.Add(Index:=1,
Layout:=ppLayoutTitle).SlideIndex
ppApp.ActiveWindow.Selection.SlideRange.Layout = ppLayoutTitleOnly
ppApp.ActiveWindow.View.Paste
ppApp.Visible = True
Set ppApp = Nothing

Regards
Jan
 
J

Jan Kronsell

I removed itm and I can see that the failing line is:

ppApp.ActiveWindow.View.GotoSlide
Index:=ActivePresentation.Slides.Add(Index:=1,
Layout:=ppLayoutTitle).SlideIndex

and it says Object required.

Jan
 
J

Jan Kronsell

Sorry for the delay. Comp. broke down (not because of PP=. Your soluttion
worked, thanks.

Jan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top