Walk folder tree and merge the presentations found

  • Thread starter Thread starter Sriram N A
  • Start date Start date
S

Sriram N A

I need to create one giant PowerPoint 2000 file out of all the various
presentations present in a folder tree on the file server for review and
rationalisation purposes.

Is it possible to walk the folder tree and append any presentations found in
each folder to my consolidated file? I have some VBA sample code for
merging two open presentations, but I don't quite konw how to extend it for
the folder tree.

Basically need to automate the stuff accomplished through the menu path
Insert | Slides from file for a whole set of folders.

Would appreciate any pointers to sample code...

Sriram
 
I got somewhat sidetracked trying to evolve recursive code to search through
the folder tree using the filesystem object (Scripting library), when the
simple solution is available within PowerPoint:

Sub ConsolidateSlides()
folder = ActivePresentation.Path
With Application.FileSearch
.NewSearch
.LookIn = folder
.SearchSubFolders = True
.FileType = msoFileTypePowerPointPresentations
.Execute
For Each file In .FoundFiles
ActivePresentation.Slides.InsertFromFile file, _
ActivePresentation.Slides.Count
Next
End With
End Sub
 
..FileSearch seems to work in some versions of Office and not in others; if
this just needs to work on your computer and a few others under your
control, then you're in business - I apologize for not having thought to
suggest it. On the other hand, if your code will be widely distributed, I'd
consider using home-grown tree-walking code instead.



--

Steve Rindsberg PPT MVP
PPTLive ( http://www.pptlive.com ) Featured Speaker
PPTools: http://www.pptools.com
PPT FAQ: http://www.pptfaq.com
 
.FileSearch seems to work in some versions of Office and not in others; if

I thought there was some (non-reproducible) evidence that under certain
conditions FileSearch does not work correctly with some versions of
Windows (not Office). Unfortunately, AFAIK, no more concrete
information about the cause is available. If FileSearch uses the same
OS interface as DIR or FileSystemObject, then the problem is with
Windows and nothing that one does with VB/A will help.

--
Regards,

Tushar Mehta, MS MVP -- Excel
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions
 
Tushar Mehta said:
if

I thought there was some (non-reproducible) evidence that under certain
conditions FileSearch does not work correctly with some versions of
Windows (not Office).

That's possible. It was utterly reproducible on one of my systems when I
reported it to MS at one point but the but report was closed. Evidently
they didn't see it there. This was on a vanilla system I'd set up for
testing Office XP. I figured if it happened to me, it was going to happen
to others as well, so I wrote .FileSearch off as unstable. It wasn't worth
taking chances, not to me.
Unfortunately, AFAIK, no more concrete
information about the cause is available. If FileSearch uses the same
OS interface as DIR or FileSystemObject, then the problem is with
Windows and nothing that one does with VB/A will help.

It's not the same as DIR (at least not the same as the Dir$() function in
VB/VBA. That works when .FileSearch doesn't. FSO, though .... maybe. I do
recall having tested to see if it was a result of Windows Search's tendency
not to return hits when file types are hidden, but that didn't seem to be
it.
 
Back
Top