Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PowerPoint VBA Switching the slide

Status
Not open for further replies.

semby

Vendor
Oct 8, 2002
33
0
0
CA
Hello:

I'm trying to write a macro script that will insert an image into slide #2 of a powerpoint presentation.

I can write one no problem that drops images into slide #1. The problem I seem to be having is accessing the method or property setting for slides other than slide #1.

With SlideShowWindows(1).View

.GotoSlide 2
ActiveWindow.Selection.SlideRange.Shapes.AddPicture(FileName:="E:\Reports\Business_Solution\OTIS\Images\OTIS_NOIbyMonthGraphgraph1.jpg", LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=26, Top:=214, Width:=488, Height:=292).Select


End With

The above code snippet is basically a copy from PowerPoint VBA help, but returns an error message of

slideshowwindows(invalid member): Integer is out of range. 1 is not in the range of 1 to 0


Any help would be appreciated.
 
Oh, I fixed my own problem.

ActiveWindow.LargeScroll Down:=2
ActiveWindow.View.GotoSlide Index:=2
ActiveWindow.Selection.SlideRange.Shapes.AddPicture(FileName:="E:\Reports\Business_Solution\OTIS\Images\OTIS_NOIbyMonthGraphgraph1.jpg", LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=26, Top:=214, Width:=488, Height:=292).Select

Works fine.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top