PDA

View Full Version : Solved: VBA code to save .doc to .docx



evamads
08-22-2008, 02:54 AM
Hi all,

I have a Word-macro that saves the active document in .docx format. But when running it, the saved document is still in "compatibility" mode. Does anyone have an idea to, how I can save the document as a real (not compatibility-mode) .docx format?

VBA code:
ActiveDocument.SaveAs FileName:="evmTest01.docx", FileFormat:=wdFormatDocumentDefault, LockComments:=False, Password:="", AddToRecentFiles:=True, WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:=False

Nelviticus
08-22-2008, 08:54 AM
Try changing 'wdFormatDocumentDefault' to 'wdFormatXMLDocument'. That seems to work for me!

evamads
08-25-2008, 04:54 AM
Hi Nelviticus,

No, sorry. I tried that, but i didn't help. But then I added the command 'ActiveDocument.Convert' before saving - and that did the trick!

So thanks anyway!