Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Save .doc file as .docx file with VBA to remove compatibility flag.

473 views
Skip to first unread message

Greg Maxey

unread,
Jul 27, 2008, 10:25:09 AM7/27/08
to
I am trying to convert a batch of .doc files to .docx files using VBA. I
have managed to "physically" convert the files, but all files converted
retain the [Compatibility flag].

I recorded two macros of the process of using the FileSaveAs command to
save two .doc documents as .docx documents. With one I selected to maintain
compatibily. The file was saved in the .docx format with the compatibility
flag. With the other I unchecked the option to maintain compatibility and
the file was saved as a .docx file without the compatibility flag.

The recorded results show no difference:

Sub Macro1()
ActiveDocument.SaveAs FileName:="Test Doc 1.docx", FileFormat:= _
wdFormatXMLDocument, LockComments:=False, Password:="", AddToRecentFiles
_
:=True, WritePassword:="", ReadOnlyRecommended:=False,
EmbedTrueTypeFonts _
:=False, SaveNativePictureFormat:=False, SaveFormsData:=False, _
SaveAsAOCELetter:=False
End Sub

Sub Macro(2)
ActiveDocument.SaveAs FileName:="Test Doc 2.docx", FileFormat:= _
wdFormatXMLDocument, LockComments:=False, Password:="", AddToRecentFiles
_
:=True, WritePassword:="", ReadOnlyRecommended:=False,
EmbedTrueTypeFonts _
:=False, SaveNativePictureFormat:=False, SaveFormsData:=False, _
SaveAsAOCELetter:=False
End Sub

How to save a .doc to .docx using VBA and remove the compatibility flag.

Thanks.

--
Greg Maxey - Word MVP

My web site http://gregmaxey.mvps.org
Word MVP web site http://word.mvps.org


Greg Maxey

unread,
Jul 27, 2008, 11:01:05 AM7/27/08
to
Stumbled on the answer:

Sub Macro1()
ActiveDocument.SaveAs FileName:="Test Doc 1.docx", FileFormat:= _
wdFormatXMLDocument, LockComments:=False, Password:="",
AddToRecentFiles _
:=True, WritePassword:="", ReadOnlyRecommended:=False,
EmbedTrueTypeFonts _
:=False, SaveNativePictureFormat:=False, SaveFormsData:=False, _
SaveAsAOCELetter:=False

ActiveDocument.Convert 'Added this line.
End Sub

0 new messages