Search code examples
c#office-automationoffice-pia

How to SaveAs in Word 97 using Word version 12 component?


I'm using the Word 2007-component in C#.

I want to save the Word document as a Word97(-2003)-document, because not everyone uses Word 2007/2010.

I thought it is easy by using the following command

document.SaveAs(AFullFileName, WdSaveFormat.wdFormatDocument97);

But then the SaveAs-dialog is shown with the assumption that I want to save it as a docx-file.

SaveAs Dialog

I've noticed that the WdSaveFormat.wdFormatDocument-flag has had the same value as WdSaveFormat.wdFormatDocument97-flag. So I think I have to do more then only using those parameters in the SaveAs-command.

Can anybody help me? I would like the format to be correct and not to see the Save As dialog.

Thanks.


Solution

  • As already suggested in comments most probably you must check that save file name, (i.e. AFullFileName argument) extension is properly set to .doc, not .docx. Word enforces that for security reasons.