Syntax
ChDefaultDir Path$, Type
Remarks
Sets one of the Word default folders to the specified path. Unlike ToolsOptionsFileLocations, which saves default folder changes in WINWORD6.INI (Windows 3.x), Word Settings (6) (Macintosh), or the registry (Windows 95 and Windows NT), ChDefaultDir changes default folders for the current Word session only. Changes made with ChDefaultDir are not reflected on the File Locations tab in the Options dialog box (Tools menu).
Argument | Explanation |
Path$ | The path to which you want to set the default folder specified by Type |
Type | A number corresponding to the default folder to set: 0 DOC-PATH 1 PICTURE-PATH 2 USER-DOT-PATH 3 WORKGROUP-DOT-PATH 4 INI-PATH 5 AUTOSAVE-PATH 6 TOOLS-PATH 7 CBT-PATH 8 STARTUP-PATH 15 The style-gallery–template path (this setting is ignored in Word version 7.0) Note that types 9 through 14 cannot be set with ChDefaultDir. To return their values for the current Word session, use DefaultDir$(). |
Example
This example creates the folder C:\BAK and then sets AUTOSAVE-PATH to that folder for the current session. The instruction On Error Resume Next prevents an error from stopping the macro if the folder already exists. On the Macintosh, substitute a folder name such as HD:BACKUP.
On Error Resume Next MkDir "C:\BAK" Err = 0 ChDefaultDir "C:\BAK", 5
See Also
ChDir, DefaultDir$(), Files$(), GetDirectory$(), ToolsOptionsFileLocations