user3018623
user3018623

Reputation: 41

Issue with VBA SaveAs method for Powerpoint files

I'm having an issue on my VBA script. I am doing some modifications on PPT tables.

At the end of the script, I want to save modifications and here is the issue.

To do the saving, I use the following command to save the file in a specific folder:

PptDoc.SaveAs (ActiveWorkbook.Path & Application.PathSeparator & "result" & Application.PathSeparator & sFilename

(PptDoc is a PowerPoint.Presentation)

Everything works fine at the execution. File is correctly saved at the correct address. Then when I want to launch the ppt, file is corrupted I can't open it. I don't know what to do, I haven't found anything on Google.

Here are some precisions :

Upvotes: 1

Views: 2283

Answers (1)

user3018623
user3018623

Reputation: 41

I finally found the solution,

Correct command is :

PptDoc.SaveAs (ActiveWorkbook.Path & Application.PathSeparator & "result" & Application.PathSeparator & sFilename, ppSaveAsOpenXMLPresentation

By default, it chooses the format equivalent to .ppt but my file was a .pptx. ppSaveAsOpenXMLPresentation means .pptx whereas ppSaveAsDefault or ppSaveAsPresentation means .ppt.

Hope this will help people having the same issue

:)

Upvotes: 2

Related Questions