Turn off compatibility mode in template for Word 2007

L

Luca Brasi

I would like to use something like

Set doc = Documents.Open("C:\Test.dot")
doc.SaveAs "C:\Test.dotx", WdSaveFormat.wdFormatXMLTemplate

to convert several old templates in the new Word 2007 file format.

Problem is that the saved new templates still are in compatibility mode.
Can I turn that off with VBA?

Thanks for any hints.
 
J

Jay Freedman

Luca said:
I would like to use something like

Set doc = Documents.Open("C:\Test.dot")
doc.SaveAs "C:\Test.dotx", WdSaveFormat.wdFormatXMLTemplate

to convert several old templates in the new Word 2007 file format.

Problem is that the saved new templates still are in compatibility
mode. Can I turn that off with VBA?

Thanks for any hints.

Between opening and saving, use the Convert method

doc.Convert

documented at http://msdn2.microsoft.com/en-us/library/bb243727.aspx. This
is the same as opening the Office button menu and clicking the Convert item
(which is visible only if the document or template is in compatibility
mode).

I don't have Word 2007 handy here to check, but I suspect you might get an
error from calling Convert for a document/template that was not in
compatibility mode. I couldn't find any property of the Document object that
would tell you whether the current document is in that mode, but an On Error
statement might catch such an error.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
L

Luca Brasi

Thank you Jay, works perfectly!
Luca

Jay said:
Between opening and saving, use the Convert method

doc.Convert

documented at http://msdn2.microsoft.com/en-us/library/bb243727.aspx. This
is the same as opening the Office button menu and clicking the Convert item
(which is visible only if the document or template is in compatibility
mode).

I don't have Word 2007 handy here to check, but I suspect you might get an
error from calling Convert for a document/template that was not in
compatibility mode. I couldn't find any property of the Document object that
would tell you whether the current document is in that mode, but an On Error
statement might catch such an error.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top