ID: Q75740
The information in this article applies to:
In Microsoft Word, you can change the default directory and default file names that appear when you click Open on the File menu.
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 "dlg" (without the
quotation marks).
3. Click Find Next.
4. At the end of the line that reads "GetCurvalues dlg," insert the
dlg.name = "*." line.
5. On the File menu, click Close, and save the changes to the document.
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" (without the quotation marks).
3. In the Setting box, type the extension you want to see. Choose Close.
For example:
DOC-EXTENSION = .txt
WARNING: ANY USE BY YOU OF THE CODE PROVIDED IN THIS ARTICLE IS AT YOUR OWN RISK. Microsoft provides this macro code "as is" 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 "Note" 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:
1. 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.
2. In the Macro Name box, type "FileOpen" (without the quotation marks)
and choose Edit or Create (Word 6.0 if the command has not previously
been modified).
3. 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 "as is" 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 "f:\winword" 'use any existing directory here
Dim dlg As FileOpen
GetCurValues dlg
dlg.AddToMru = 1
dlg.Name = "*.*"
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.
Word for the Macintosh, Versions 6.0, 6.0.1
-------------------------------------------
Sub Main
Dim dlg As FileOPen
GetCurValues dlg
dlg.AddToMru = 1
dlg.Name = MacID$("****")
If Dialog(dlg) Then FileOpen dlg
End Sub
Word Version 1.x, 2.x
---------------------
Sub MAIN
ChDir "f:\winword" 'use any existing directory here
Dim dlg As FileOpen
GetCurValues dlg
dlg.Name = "*.*"
If Dialog(dlg) Then
Super FileOpen dlg
End If
End Sub
4. 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" (without the quotation marks).
3. Type a description, such as "Opens all files" (without the quotation
marks).
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.
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, "Do you want to save the global glossary and command changes?" may appear. Choose Yes to save your changes.
"Microsoft Word for Windows User's Guide," version 2.0, page 765
"Microsoft Word for Windows User's Reference," versions 1.x, pages 186-189
"Microsoft Word for Windows Technical Reference," pages 16-17, 115
"Microsoft Word for Windows and OS/2 Technical Reference," pages 95-97
KBCategory: kbusage kbmacro kbtlc KBSubcategory:
Additional query words: 2.0 2.0a 2.0a-CD 2.0b 2.0c 6.0 6.0a 6.0c 7.0 grey gray unavailable 1.x set winword macword winword2 word6 word7 word95 filespec default WordBasic
Keywords : kbmacro kbusage
Version : MACINTOSH:6.0,6.0.1; WINDOWS:1.0,1.1,1.1a,2.0,2.0a,2.0a-CD,2.0b,2.0c,6.0,6.0a,6.0c,7.0,7.0a
Platform : MACINTOSH WINDOWS
Last Reviewed: April 13, 1999