Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

List templates used

8 views
Skip to first unread message

SV

unread,
Oct 19, 2009, 10:46:45 AM10/19/09
to
I have a large number of presentations contained in a folder and want
to be able to list the template and "last saved by" author for each
ppt file. Ideally I would put the data into a data file for export to
xls.

I assume that this can be done with VBA but what parameters are used?

Any ideas

Steve

Steve Rindsberg

unread,
Oct 19, 2009, 4:19:34 PM10/19/09
to

Something like this. It'll get unhappy if you have password protected presentations and a few
other oddities may upset it:


' Copy and paste this into a module then run ForEachPresentation:
Option Explicit
Public sMsg As String

Sub ForEachPresentation()
' Run a macro of your choosing on each presentation in a folder

Dim rayFileList() As String
Dim FolderPath As String
Dim FileSpec
Dim strTemp As String
Dim x As Long
Dim iFileNum As Integer
Dim sFileName As String

' EDIT THESE to suit your situation
FolderPath = "q:\@support\" ' Note: MUST end in \
FileSpec = "*.ppt"
sFileName = "C:\Temp\List.txt" ' FULL path to the output file
' END OF EDITS

' Fill the array with files that meet the spec above
ReDim rayFileList(1 To 1) As String
strTemp = Dir$(FolderPath & FileSpec)
While strTemp <> ""
Select Case UCase(Right$(strTemp, 4))
Case Is = "PPTX", "PPTM", "PPSX"
' ignore it
Case Is = ".PPT"
rayFileList(UBound(rayFileList)) = FolderPath & strTemp
ReDim Preserve rayFileList(1 To UBound(rayFileList) + 1) As String
End Select
strTemp = Dir
Wend

' array has one blank element at end - don't process it
' don't do anything if there's less than one element
If UBound(rayFileList) > 1 Then
For x = 1 To UBound(rayFileList) - 1
Call MyMacro(rayFileList(x))
Next x
End If

iFileNum = FreeFile
Open sFileName For Output As iFileNum
Print #iFileNum, sMsg
Close iFileNum

End Sub

Sub MyMacro(strMyFile As String)
' this gets called once for each file that meets the spec you enter in ForEachPresentation
' strMyFile is set to the file name each time

Dim oPresentation As Presentation
On Error Resume Next

Set oPresentation = Presentations.Open(strMyFile)

With oPresentation

sMsg = .FullName & vbTab & .TemplateName & vbTab & .BuiltInDocumentProperties("Last
Author") & vbCrLf
.Close

End With

End Sub

==============================
PPT Frequently Asked Questions
http://www.pptfaq.com/

PPTools add-ins for PowerPoint
http://www.pptools.com/


0 new messages