none
Using VBA to convert a .DOC file to .DOCX

    Question

  • We are moving from Word 2003 to 2010.  Users frequently use old docs to create new docs.  I wrote a vba macro to convert an .DOC to a .DOCX file (using the .SaveAs2 wdFormatDocumentDefault parameter), attach to the new template, insert new headers/footers, etc.  However, after saving the document in the new format, the title bar still shows [Compatibility Mode].  Why?  It opens okay as a DOCX file, but appears it may not really be a "true" DOCX file.

    If I repeat the steps manually, I am prompted "You are about to save the file in a new format...  Press OK to continue."  Apparently it is this step that removes the [Compatibility Mode].  How can I perform that step programmatically?

    Friday, January 27, 2012 12:49 AM

Answers

  • The wdFormatDocumentDefault was the correct parameter.  It was activedocument.Convert I was missing.

    • Marked as answer by orlandp Friday, January 27, 2012 3:57 PM
    Friday, January 27, 2012 3:57 PM

All replies

  • Hi Orland

    Try wdFormatDocument instead of the default document format. This is apparently saving in the Word 2007 docx file format.


    Cindy Meister, VSTO/Word MVP
    Friday, January 27, 2012 8:23 AM
    Moderator
  • The wdFormatDocumentDefault was the correct parameter.  It was activedocument.Convert I was missing.

    • Marked as answer by orlandp Friday, January 27, 2012 3:57 PM
    Friday, January 27, 2012 3:57 PM