WD: Macro to Change Default FileSaveAs Directory
ID: Q110629
|
The information in this article applies to:
-
Microsoft Word for Windows, versions 2.0, 2.0a, 2.0a-CD, 2.0b, 2.0c, 6.0, 6.0a, 6.0c
-
Microsoft Word for Windows NT, version 6.0
-
Microsoft Word for Windows 95, versions 7.0, 7.0a
SUMMARY
In Word for Windows, the Save As command on the File menu always uses
the current directory by default. Since the current directory can change,
(for example when you insert a picture from a ClipArt directory), the
default directory may not be consistent.
To configure Word to default to a specific directory when saving files,
modify the FileSaveAs macro.
MORE INFORMATION
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.
To modify the FileSaveAs macro to default to a specific directory when Word
performs a Save As:
- From the Tools menu, choose Macro.
- In the Macro Name box, type FileSaveAs.
- Click the Create button.
The macro should appear as follows:
Sub MAIN
Dim dlg As FileSaveAs
GetCurValues dlg
Dialog dlg
Super FileSaveAs dlg
End Sub
- Change the macro to the following (in this example, the default
directory is being changed to "C:\WINWORD"):
Word for Windows 2.0
Sub MAIN
Dim dlg As FileSaveAs
GetCurValues dlg
ChDir "C:\WINWORD" ' this line is new
n = Dialog dlg ' this line is modified
If n = - 1 Then Super FileSaveAs dlg ' this line is modified
End Sub
Word for Windows NT, Word for Windows 6.0, Word for Windows 95
Sub MAIN
Dim dlg As FileSaveAs
GetCurValues dlg
ChDir "f:\winword" 'use any existing directory here
dlg.AddToMru = 1
If Dialog(dlg) Then FileSaveAs dlg
End Sub
NOTE: You can specify any valid path you want on the ChDir line.
- From the File menu, choose Close. When you are prompted to keep the
changes to Global:FileSaveAs, choose Yes.
- From the File menu, choose Exit. When you are prompted to save global
glossary and command changes, choose Yes.
Word will now always default to the directory specified in the FileSaveAs
macro when saving a file.
For more information about changing the default directory, query on the
following words in the Microsoft Knowledge Base:
default and change and working and directory and icon
Additional query words:
Keywords : kbmacro kbusage wordnt kbmacroexample winword word6 winword2 word7 word95
Version : WINDOWS:2.0,2.0a,2.0a-CD,2.0b,2.0c,6.0,6.0a,6.0c,7.0,7.0a; winnt:6.0
Platform : WINDOWS winnt
Issue type : kbhowto
|