Results 1 to 2 of 2
2009-10-16, 09:46 #1
- Join Date
- Mar 2003
- Elkins Park, Pennsylvania, USA
- Thanked 0 Times in 0 Posts
Hi. I'm hoping someone has a quick insight into my problem.
I have legacy documents in Word 2003 DOC format. These documents are forms, protected for fill-in only. (Are you with me so far?) There are no macros, but there are pick-lists. I simply want to convert the documents to the new DOCX (?) format, but it isn't nearly as straightforward as I thought.
Using this (simplified) code, I can save them with a DOCX extension, but it obviously isn't a true 2007 document; when I try to open it, Word fails with a "Word experienced an error trying to open this file..." message and it won't open.
strNewFilename = "newfile.docx"When I manually use Save As... and select DOCX as the format, I receive the normal you're-about-to-change-the-format prompt, but I then get the message "The following cannot be saved in a macro-free document: VBA Project" and I'm told to choose a macro-enabled format.
ActiveDocument.SaveAs FileName:=strNewFilename, FileFormat:=wdFormatDocument
Aside from the fact that there are really no VBA modules in the document (only form pick-lists), how can I do this via code? What FileFormat should be used? (Why is this so nebulous!?)<font face="Comic Sans MS">That's what you do in a herd; you look out for each other!</font face=comic> - Mike
2009-10-16, 10:01 #2
- Join Date
- Mar 2002
- Thanked 28 Times in 28 Posts
You need to enable the new features first:
In the SaveAs line, specify wdFormatXMLDocument or if that doesn't work, wdFormatXMLDocumentMacroEnabled as FileFormat. In the latter case, you should use extension .docm instead of .docx.