*** Sorry just noticed the typo in the title. Should say: "twice", not "twicen". (No drink taken).
Hi All,
Happy New Year. (At least it is New Year in Scotland).
I normally make a nuisance of myself in the Excel forum, but tonight it's the Word forum's turn to be unlucky.
I know very little about Word, so my question may well be entirely stupid, but here goes.
I am using Office 2010, 32-bit on a stand-alone laptop.
I have the following code in my document:
' This procedure sets the file extension as "docx" before save prompt
Private Sub App_DocumentBeforeSave(ByVal Doc As Document, SaveAsUI As Boolean, Cancel As Boolean)
With Application.Dialogs(wdDialogFileSaveAs)
.Format = wdFormatXMLDocument
.Show
End With
End Sub
The active document at this point is a "docm" file as I have some VBA code in it. However, when the user saves the document I want it to save as a "docx" file. Therefore, I am trying to set the extension to save the user doing it. (All the Application code is already in place). The "docx" extension does show in the dialog box and the document saves as a "docx" file, without the VBA from the original file. However, the dialog box shows a second time, with a "docm" file type specified (as per the original file, which is still open). My question is how do I stop the dialog box showing a second time? Or, is there a better way of doing what I am trying to do?
Many thanks and best regards.