logo
search
Others

How to Show the Word VBA Save As Dialog in a Specific Folder

John WilsonJohn Wilson Oct 21, 2026 869 views

Question details

The user wants to write a VBA macro that opens the built-in 'Save As' dialog explicitly pointing to a specific folder path and pre-filling a file name.

How to Show the Word VBA Save As Dialog in a Specific Folder
Product
Word / WPS Writer
Device & OS
not provided
Scenario
Automating document saving processes where a specific default directory and file name need to be presented to the user for confirmation.
Observed behavior
The standard Save As dialog defaults to the current working directory, but the user requires it to open in a custom, hardcoded path via VBA.
Before you start

Ensure that the Developer tab is enabled in your word processor and that your document is saved as a Macro-Enabled Document (.docm) to successfully run VBA codes.

Solution 1Recommended

Use the Built-in Save As Dialog Object in VBA

You can configure the wdDialogFileSaveAs dialog object to pre-fill the directory path and file name before displaying it to the user.

This method leverages the built-in dialog collections in your word processor. By passing a specific path string to the dialog's .Name property, you force the Save As window to open directly in your desired folder instead of the default documents folder.

1
Open the VBA Editor

Press ALT + F11 on your keyboard to launch the Visual Basic for Applications (VBA) Editor.

2
Insert a New Module

In the top menu, click 'Insert' and select 'Module' to create a blank script window.

3
Paste the Macro Code

Copy and paste the following code into the module window: Sub ShowSaveAsDialog() Dim strName As String strName = "Test.docx" With Application.Dialogs(wdDialogFileSaveAs) .Name = "C:\Steve\" & strName .Show End With End Sub

4
Customize the Folder Path

Change the path "C:\Steve\" to the actual target folder on your computer, and update "Test.docx" to your preferred default file name. Press F5 to run the macro.

Use the Built-in Save As Dialog Object in VBA
Path Requirement: Make sure the target folder (e.g., C:\Steve\) actually exists on your system and includes the trailing backslash. If the folder does not exist, the dialog will simply default to your current working directory.
WPS Office Macro Support

Run VBA Macros to Automate Tasks in WPS Writer

WPS Office provides robust support for VBA macros, allowing you to automate repetitive tasks like custom save dialogs just as you would in Microsoft Word.

  1. 1. Open WPS Writer: Launch WPS Office and open your document in the WPS Writer application.
  2. 2. Access the Developer Tab: Navigate to the Developer tab on the top ribbon to access the macro tools.
  3. 3. Open the Macro Editor: Click on 'Macros' or press ALT + F11 to launch the built-in WPS VBA Editor.
  4. 4. Run Your Code: Insert a new module, paste your custom Save As dialog VBA code, and execute it to streamline your workflow.
Highly compatible with Microsoft Word VBA codes and macro-enabled formats (.docm)Built-in Macro Editor for seamless script creation and debuggingLightweight architecture ensures fast execution of automated workflowsFamiliar user interface requires zero learning curve
microsoft office alternative - wps office

Frequently Asked Questions

Why does the Save As dialog open in the default Documents folder instead of my specific path?

This usually happens if the folder path specified in the VBA code does not exist, or if you forgot to include the trailing backslash at the end of the path string (e.g., using "C:\Folder" instead of "C:\Folder\").

Can I change the default file format in the Save As dialog using VBA?

Yes, you can specify the file format by modifying the dialog object properties before displaying it. You can set the .Format property to specific constants, such as wdFormatPDF, to default the dialog to saving as a PDF.

How do I capture the file path the user actually selected in the dialog?

Instead of using the .Show method, you can use .Display. If the user clicks Save, .Display returns -1. You can then retrieve the user-selected path from the dialog's .Name property or execute an explicit ActiveDocument.SaveAs2 command.