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!

Insert Slides using VBA (PPT) 1

Status
Not open for further replies.

moontho

Technical User
Jun 4, 2003
85
0
0
GB
I'm trying to insert predefined slides from an other presentation and have found the following code

ActivePresentation.Slides.InsertFromFile _
"c:\ppt\sales.ppt", 2, 3, 6

which inserts the specified slides after slide 2, but how do i make it so it'll insert the files after whatever slide the user is on?

Many thanks

thom
 
thom,

use [tt]ActiveWindow.View.Slide.SlideIndex[/tt] to return the slide index number (long) of the slide currently visible in the active presentation.

Code:
ActivePresentation.Slides.InsertFromFile "<FileName.ppt>", ActiveWindow.View.Slide.SlideIndex

HTH

Cheers
Nikki
[bat] Look, mommy, I'm flying!
 
thanks for this, but now i'm uncertain how to specify that I only want 1 slide inserted, e.g. slide 5

many thanks

Thom
 
thom

just specify the index of the slide you want to insert:

Code:
ActivePresentation.Slides.InsertFromFile "YourFileName.ppt", ActiveWindow.View.Slide.SlideIndex, 5, 5
[/code
will insert slide5
[code]ActivePresentation.Slides.InsertFromFile "YourFileName.ppt", ActiveWindow.View.Slide.SlideIndex, 5
will insert all slides startting with slide 5

HTH

Cheers
Nikki
[bat] Look, mommy, I'm flying!
 
Fantasic. Job done. Have a star.

Many thanks

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top