oPresentation.SaveAs ... PowerPoint2007

S

SV

I tried to modify http://www.pptfaq.com/FAQ00740.htm to save as
PowerPoint2007

Looking at http://www.eggheadcafe.com/software/aspnet/34812242/vbasaveas.aspx

suggests that I should use ppSaveAsOpenXMLPresentation as the
ppSaveAsFileType

The resulting code (below) works but the file extension is still .ppt
and not .pptx

The file size is reduced so something is happening!

Is there something missing??

Steve



Sub BatchSave()
' Opens each PPT in the target folder and saves as PPT2007 format

Dim sFolder As String
Dim sPresentationName As String
Dim oPresentation As Presentation

' Get the foldername:

sFolder = "c:\Users\Me\My Documents\TestExtract\" ' Note: MUST
end in \

If sFolder = "" Then
Exit Sub
End If

' Make sure the folder name has a trailing backslash
If Right$(sFolder, 1) <> "\" Then
sFolder = sFolder & "\"
End If

' Are there PPT files there?
If Len(Dir$(sFolder & "*.PPT")) = 0 Then
MsgBox "Bad folder name or no PPT files in folder."
Exit Sub
End If

' Open and save the presentations
sPresentationName = Dir$(sFolder & "*.PPT")
While sPresentationName <> ""
Set oPresentation = Presentations.Open(sFolder &
sPresentationName, , , False)
Call oPresentation.SaveAs(sFolder & "N_" & sPresentationName,
ppSaveAsOpenXMLPresentation, msoFalse)
oPresentation.Close

sPresentationName = Dir$()
Wend

MsgBox "DONE"

End Sub
 
J

John Wilson

Does this modification work?

Sub BatchSave()
' Opens each PPT in the target folder and saves as PPT2007 format

Dim sFolder As String
Dim sPresentationName As String
Dim oPresentation As Presentation
Dim new_Name As String

' Get the foldername:

'sFolder = "c:\Users\Me\My Documents\TestExtract\" ' Note: MUSTend in \
sFolder = "C:\Users\John\Desktop\test\" ' Note: MUSTend in \

If sFolder = "" Then
Exit Sub
End If

' Make sure the folder name has a trailing backslash
If Right$(sFolder, 1) < "\" Then
sFolder = sFolder & "\"
End If

' Are there PPT files there?
If Len(Dir$(sFolder & "*.PPT")) = 0 Then
MsgBox "Bad folder name or no PPT files in folder."
Exit Sub
End If

' Open and save the presentations
sPresentationName = Dir$(sFolder & "*.PPT")
While sPresentationName <> ""
Set oPresentation = Presentations.Open _
(sFolder & sPresentationName, , , False)
new_Name = Replace(sPresentationName, ".ppt", ".pptx")
On Error Resume Next
MkDir sFolder & "\converted\"
Call oPresentation.SaveAs(sFolder & "\converted\" _
& new_Name, ppSaveAsOpenXMLPresentation) 'change
oPresentation.Close
sPresentationName = Dir$()
Wend
MsgBox "DONE"
End Sub


SV said:
I tried to modify http://www.pptfaq.com/FAQ00740.htm to save as
PowerPoint2007

Looking at
http://www.eggheadcafe.com/software/aspnet/34812242/vbasaveas.aspx

suggests that I should use ppSaveAsOpenXMLPresentation as the
ppSaveAsFileType

The resulting code (below) works but the file extension is still .ppt
and not .pptx

The file size is reduced so something is happening!

Is there something missing??

Steve



Sub BatchSave()
' Opens each PPT in the target folder and saves as PPT2007 format

Dim sFolder As String
Dim sPresentationName As String
Dim oPresentation As Presentation

' Get the foldername:

sFolder = "c:\Users\Me\My Documents\TestExtract\" ' Note: MUST
end in \

If sFolder = "" Then
Exit Sub
End If

' Make sure the folder name has a trailing backslash
If Right$(sFolder, 1) <> "\" Then
sFolder = sFolder & "\"
End If

' Are there PPT files there?
If Len(Dir$(sFolder & "*.PPT")) = 0 Then
MsgBox "Bad folder name or no PPT files in folder."
Exit Sub
End If

' Open and save the presentations
sPresentationName = Dir$(sFolder & "*.PPT")
While sPresentationName <> ""
Set oPresentation = Presentations.Open(sFolder &
sPresentationName, , , False)
Call oPresentation.SaveAs(sFolder & "N_" & sPresentationName,
ppSaveAsOpenXMLPresentation, msoFalse)
oPresentation.Close

sPresentationName = Dir$()
Wend

MsgBox "DONE"

End Sub

__________ Information from ESET Smart Security, version of virus
signature database 4674 (20091209) __________

The message was checked by ESET Smart Security.

http://www.eset.com

__________ Information from ESET Smart Security, version of virus signature database 4674 (20091209) __________

The message was checked by ESET Smart Security.

http://www.eset.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top