WD97: Changing the Default File Name and Directory

Last reviewed: February 4, 1998
Article ID: Q158348
The information in this article applies to:
  • Microsoft Word 97 for Windows

SUMMARY

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

MORE INFORMATION

Microsoft provides examples of Visual Basic for Applications procedures for illustration only, without warranty either expressed or implied, including, but not limited to the implied warranties of merchantability and/or fitness for a particular purpose. The Visual Basic procedures in this article are provided 'as is' and Microsoft does not guarantee that they can be used in all situations. While Microsoft support engineers can help explain the functionality of a particular macro, they will not modify these examples to provide added functionality, nor will they help you construct macros to meet your specific needs. If you have limited programming experience, you may want to consult one of the Microsoft Solution Providers. Solution Providers offer a wide range of fee-based services, including creating custom macros. For more information about Microsoft Solution Providers, call Microsoft Customer Information Service at (800) 426-9400.

Displaying All or a Specific type of Files in a Directory

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

  1. On the Tools menu, point to Macro, and then click Macros.

  2. In the Macro Name box, type "FileOpen" (without the quotation marks). Then, click Create.

  3. The macro-editing window displays the FileOpen macro.

    Make the following changes to this macro:

       Sub FileOpen()
          Application.ChangeFileOpenDirectory ("C:\My documents")
                'use any existing directory in the above line
          With Dialogs(wdDialogFileOpen)
             .Name = "*.*"    'use any extension type here, i.e.: "*.RTF"
             .Show
          End With
       End Sub
    
    

  4. On the File menu, click Close And Return To Microsoft Word.

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

Changing the Default Word Extension:

WARNING: ANY USE BY YOU OF THE PROCEDURE PROVIDED IN THIS ARTICLE IS AT YOUR OWN RISK. The use of the provided procedure may cause unexpected results on some systems. Microsoft provides this procedure "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.

Use the following procedure to change the default file extension that appears when you click Open or Save on the File menu.

  1. On the Tools menu, click Templates And Add-ins.

  2. On the Templates And Add-ins screen, click the Add button.

  3. Change to the Macros folder that is located under the Office folder. Then select Support8.dot and click OK.

    This will add the Support8.dot template as a global template. Click OK to close the Templates and Add-ins screen.

  4. On the Tools menu, point to Macro, and then click Macros. Under Macro Name, select RegOptions, then click Run.

  5. From the Set Registry Options screen, select the Word 8.0 Options tab. Under Option, select DOC-Extension. On the Setting line, type in the desired extension (for example, .doc), and then click OK.

Changing the Default Directory

To change the default directory that will display when you click Open on the File menu, use either of the following methods.

Method 1: Use the following steps to manually change the default directory:

          a. On the Tools menu, click Options.

          b. Select the File Locations tab.

          c. Under "File Types," select Documents, and then click Modify.

          d. Change to the desired location.

Method 2: Add an Application.ChangeFileOpenDirectory statement to your
          FileOpen macro. Refer to the previous macro example, the
          directory specified in the Application.ChangeFileOpenDirectory
          line must be a valid directory on your system.

          NOTE: When you exit Word for Windows after you have modified or
          added these changes, you may be prompted to save the changes to
          the Normal template. Choose Yes to save your changes.


Additional query words: grey gray unavailable set filespec filetype
format 8.0
Keywords : word8 word97 kbmacro kbusage
Version : 97
Platform : WINDOWS


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: February 4, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.