PDA

View Full Version : Question on importing 1 slide from all files within a directory



KMR
08-31-2007, 06:13 AM
Hopefully I have been forgiven for my last bit of stupidity (bad path) and you will all take pity on me :yes

Anyway, this is a slightly different question from the last. I am importing a single slide (the first 1) from 27 different presentations. These are inputs from multiple individuals - who I know will not stick to a naming convention...so...instead of hard coding the file names, I would rather just import all the files (first slide of each) into my master. Then I can re-arrange the order of the slides to the order I want, which I think would be faster than changing all the filenames to be compliant.

Here is my working code (a snippet)...

ActivePresentation.Slides.InsertFromFile "c:\Weekly Import\file1.ppt", 1, 1, 1
ActivePresentation.Slides.InsertFromFile "c:\Weekly Import\file2.ppt", ActivePresentation.Slides.Count, 1, 1
ActivePresentation.Slides.InsertFromFile "c:\Weekly Import\file3.ppt", ActivePresentation.Slides.Count, 1, 1
ActivePresentation.Slides.InsertFromFile "c:\Weekly Import\file4.ppt", ActivePresentation.Slides.Count, 1, 1

Can anyone tell me how to do this? Grab all files from a directory?

Thanks a ton.

Kelly
VBA Newbie

John Wilson
08-31-2007, 10:02 AM
I could hardly improve on this so :
http://pptfaq.com/FAQ00536.htm