Article ID: 183957
Article Last Modified on 10/11/2006
181058 OFF98: How to Run Sample Code from Knowledge Base Articles
Sub BatchConvert()
' Declare variables.
Dim i as Integer
Dim oPres As Presentation
Dim strPath As String
' Get the path of the active presentation.
strPath = ActivePresentation.Path
' Make sure that path is not an empty string.
If "" = strPath Then
MsgBox "The Active presentation does not have a path. The " _
& "presentation may not be saved. Please open a presentation " _
& "from the location that has the presentations you want to " _
& "convert."
End
End If
' Search for presentations.
With Application.FileFind
' Set up the search criteria.
.SearchPath = strPath
.Options = msoOptionsNew
.FileType = msoFileTypePowerPointPresentations
.SearchSubFolders = False
' Start the search.
.Execute
' Check to see if the search returned any files.
With .FoundFiles
If .Count > 0 Then
' Loop through the found presentations.
For i = 1 To .Count
' Open the Presentation
Set oPres = Presentations.Open(.Item(i))
' Save the presentation and append 98 to the end of
' the presentation name.
oPres.SaveAs oPres.Name & " 98", ppSaveAsPresentation
' Close the presentation.
oPres.Close
Next i
' Display a dialog box that indicates how many presentations
' were converted.
MsgBox "Converted " & .Count & " presentations."
Else
MsgBox "No PowerPoint" _
& " files were found."
End If
' End the FoundFiles With statement.
End With
' End the FileFind With statement.
End With
End Sub
163435 VBA: Programming Resources for Visual Basic for Applications
Additional query words: vbe update migration updating mac_ppt ppt98 ppt_98 powerpoint 8.00 mac_powerpt powermac powerpt
Keywords: kbhowto kbconversion kbmacroexample kbdtacode kbcode KB183957