Microsoft KB Archive/75740

{|
 * width="100%"|

How to Change the Default File Name/Directory in Open Dialog

 * }

Q75740

-

The information in this article applies to:


 * Microsoft Word for Windows, versions 1.0, 1.1, 1.1a, 2.0, 2.0a, 2.0a-CD, 2.0b, 2.0c, 6.0, 6.0a, 6.0c
 * Microsoft Word for Windows, versions 7.0, 7.0a
 * Microsoft Word for the Macintosh, versions 6.0, 6.0.1

-

SUMMARY
In Microsoft Word, you can change the default directory and default file names that appear when you click Open on the File menu.

Word 6.x for Windows
In Microsoft Word version 6.x for Windows, you can modify the FileOpen macro to list all files or only files with a particular extension within a directory. You can also modify the FileNew macro to change the default directory that is displayed when you choose New from the File menu.

If you have the Scanprot.dot macros installed on your computer, use the following steps:


 * 1) Open the ShellOpen macro.
 * 2) On the Edit menu, click Find, and search for &quot;dlg&quot; (without the quotation marks).
 * 3) Click Find Next.
 * 4) At the end of the line that reads &quot;GetCurvalues dlg,&quot; insert the dlg.name = &quot;*.&quot; line.
 * 5) On the File menu, click Close, and save the changes to the document.

Changing the Default Extension in Word 2.x for Windows
Adding a DOC-EXTENSION line to the WIN.INI file will change the default file extension that appears when you use the Open and Save commands on the file menu are used. Use the following procedure to make this change:


 * 1) On the Tools menu, click Options, and click the WIN.INI icon.
 * 2) In the Options box, type DOC-EXTENSION.
 * 3) In the Setting box, type the extension you want to see. Choose Close. For example:

Displaying All Files in a Directory
WARNING: ANY USE BY YOU OF THE CODE PROVIDED IN THIS ARTICLE IS AT YOUR OWN RISK. Microsoft provides this macro code &quot;as is&quot; without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.

CAUTION: See the &quot;Note&quot; section below this procedure before proceeding.

To modify the FileOpen macro so that it will list all the files in a specific directory, do the following:

 In versions 1.x of Word for Windows, choose Edit from the Macro menu. In versions 2.x, 6.0 and 7.0 of Word, choose Macro from the Tools menu. In the Macro Name box, type FileOpen and choose Edit or Create (Word 6.0 if the command has not previously been modified).  The macro-editing window displays the FileOpen macro. Make the following changes to this macro:

WARNING: ANY USE BY YOU OF THE CODE PROVIDED IN THIS ARTICLE IS AT YOUR OWN RISK. Microsoft provides this macro code &quot;as is&quot; without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.

Word for Windows, Versions 6.0 and 7.0
     Sub MAIN ChDir &quot;f:\winword&quot;     'use any existing directory here Dim dlg As FileOpen GetCurValues dlg dlg.AddToMru = 1 dlg.Name = &quot;*.*&quot; If Dialog(dlg) Then FileOpen dlg End Sub Note: If you use this macro to replace the built-in FileOpen macro, the MRU (Most Recently Used) list will not be updated unless a file is opened and saved. This macro will also disable the print function in the File Open dialog box in Word 7.0.  On the File menu, click Close and save changes to Global:FileOpen.

Now when you click Open on the File menu, the File Name list box will display all the files in the desired directory.

NOTE: If you use this macro to replace the built-in FileOpen macro, the Find button will no longer be available in the Open dialog box in Word 1.x and 2.x. The OK and Cancel buttons will be the only buttons available. To use the macro listed above while keeping the Find option accessible in the Open dialog box, create the above macro in addition to the FileOpen macro instead of replacing it. The following steps outline this procedure:


 * 1) In Word 1.x for Windows, click Edit on the Macro menu. In Word 2.x for Windows, click Macro on the Tools menu.
 * 2) Type a new macro name, such as OpenAll.
 * 3) Type a description, such as Opens all files.
 * 4) In the macro-editing window, type the macro as it appears in the above procedure. From the File menu, choose Close and save the changes to the Global:OpenAll macro.

You can now assign this macro to the File menu so that it appears in addition to the regular Open command. The Find button will remain functional in the Open dialog box when you run the FileOpen macro.

Changing the Default Directory
To change the default directory that will appear when you click Open on the File menu, add a ChDir statement to your FileOpen macro. Refer to the previous macro examples. In the macros listed above, the directory specified in the ChDir line must be a valid directory on your system.

NOTE: When you exit Word for Windows after you have modified or added any of these macros the message, &quot;Do you want to save the global glossary and command changes?&quot; may appear. Choose Yes to save your changes.