Little VBA Help

User avatar
arroway
3StarLounger
Posts: 368
Joined: 04 Jan 2012, 22:43

Little VBA Help

Post by arroway »

I'm running a save macro where in it I've got a line:

Format(ActiveDocument.FormFields("aReviewDate").Result, "yymmdd") & _
".docm"

I'm trying to get the document to save as a .docm but each time it's saved it reverts back to a .docx.

What can I add to it to make it save as a .docm???

I'm using a cut and paste version of some old code and in that code I forced it to save as a .doc by using:

.Format = wdFormatDocument97

But I don't know how to write it so it formats it as a .docm. Am I on the right path? Can someone help please?

Thanks!
-Dax
It takes 2 to tango; unless you speak binary; then it takes 10.

User avatar
HansV
Administrator
Posts: 78456
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Little VBA Help

Post by HansV »

Try this:

Code: Select all

    ActiveDocument.SaveAs FileName:=Format(ActiveDocument.FormFields("aReviewDate").Result, "yymmdd") & ".docm", _
        FileFormat:=wdFormatXMLDocumentMacroEnabled
Best wishes,
Hans

User avatar
arroway
3StarLounger
Posts: 368
Joined: 04 Jan 2012, 22:43

Re: Little VBA Help

Post by arroway »

Actually,

.Format = wdFormatXMLDocumentMacroEnabled

works perfect! Thanks Hans!!
It takes 2 to tango; unless you speak binary; then it takes 10.