Vba – Programmatically save as PowerPoint 2007 (pptx), from PowerPoint 2003

openxmlpowerpointvba

I need to be able to save Presentations (programatically) in PowerPoint 2003 as OpenXML (".pptx").
I installed the Microsoft Office Compatibility Pack. This indeed allows me to perform "Save as PowerPoint 2007 Presentation" from PowerPoint 2003.

How can I do this programmatically? (e.g. VBA)

I tried Presentation.SaveAs:
While there is no inherent PpSaveAsFileType enum value in PowerPoint 2003 for ppSaveAsOpenXMLPresentation, I made a program which prints the PpSaveAsFileType values and found out that during run-time, ppSaveAsOpenXMLPresentation = 24.

However, I tried:
SaveAs(@"c:\temp\saveas\pupik.pptx", (PpSaveAsFileType) ((int) 24), MsoTriState.msoTrue);

And got an "Invalid Enumeration Value" Exception

Any ideas how to make this work?

(PS – I am aware that this question was already asked by several people on the web, but no solutions were offered.)

Thanks,
Arie

Best Answer

Edit > Some grammar

AFAIK the pptx format does not support macro-enabled presentations, so if your code is in the presentation you are trying to save, it will not work.

I don't have Excel 2003 at hand now, but if the Compatibility Pack enabled the option "pptx" in the Configuration Dialog, Default Save Format, and you are trying to save ANOTHER presentation I guess you can if you use something like:

 MyOtherPresentation.SaveAs "C:\Mypres", ppSaveAsDefault

Please note that this may work only if the presentation had not been saved before in ppt format

EDIT

If the above doesn't work, you could try a different approach. Save the file in the old format and the call a conversion program:

ppcnvcom.exe
See here for an example (using wordconv.exe, but essentially the same)
Be sure to have all the office upgrades installed, because if not the program ends reporting no error and doing nothing.

ofc
See here for instructions
And here for a good discussion

HTH!

Related Topic