VBA & Macro Problems

Set the Word VBA Save As Dialog Default to DOCX

Huda QurayshiHuda Qurayshi Nov 27, 2026 869 views

Question details

Set a Word VBA Save As dialog to default to the standard DOCX format while allowing the user to choose a file name and location.

Set the Word VBA Save As Dialog Default to DOCX
Product
Microsoft Word
Device & OS
not provided
Scenario
A VBA macro opens the Save As dialog using Application.Dialogs(wdDialogFileSaveAs).Show.
Observed behavior
The dialog defaults to the macro-enabled DOCM format instead of standard DOCX.
Before you start

Open the document containing or using the macro, and make sure you can access its VBA code in the Visual Basic Editor. A standard DOCX file cannot retain VBA macros.

Solution 1Recommended

Set the Save As dialog format to standard DOCX

Set the dialog's Format property before displaying it so users can choose a name and location with DOCX as the initial format.

1
Open the macro

In Word, open the Developer tab and select Visual Basic. In the VBA editor, open the module containing the Save As macro.

2
Set the dialog format

Replace the existing dialog call with: With Application.Dialogs(wdDialogFileSaveAs) .Format = wdFormatXMLDocument .Show End With

3
Run and check the dialog

Run the macro from Developer > Macros. In the Save As dialog, check that Word Document (*.docx) is selected, then choose a file name and location and select Save.

Set the Save As dialog format to standard DOCX
DOCX does not retain macros: Word may warn that VBA content cannot be saved in a macro-free document. The user can also change the file type in the dialog; setting Format only establishes the initial choice.
Free Microsoft Office alternative

Work with Word documents in WPS Writer

WPS Office is a free, lightweight and easy-to-use alternative with a familiar interface and Microsoft Office format compatibility for a smooth transition. It does not fix Word-specific VBA dialog behavior, and macros should be tested separately.

Save documents in standard DOCX format from WPS WriterCompatible with Microsoft Word DOCX and DOC formatsFamiliar document-editing interfaceFree and lightweight office suite
microsoft office alternative - wps office

Frequently Asked Questions

Which VBA constant selects standard DOCX?

Use wdFormatXMLDocument for a standard DOCX file. Set the Save As dialog's Format property to this constant before calling .Show.

Which constant selects a macro-enabled Word document?

Use wdFormatXMLDocumentMacroEnabled for the DOCM format when the saved document needs to retain VBA macros.

Can users still choose a different format?

Yes. Setting the dialog's Format property establishes the initial selection; users can change the file type in the Save As dialog before saving.

Will a DOCX file keep the document's VBA macros?

No. DOCX is a macro-free format. To retain macros in the saved document, choose Word Macro-Enabled Document (*.docm) in the Save As dialog.