Macro to Change Default *.XL* to *.* in Open Dialog Box

Last reviewed: September 2, 1997
Article ID: Q104581

The information in this article applies to:
  • Microsoft Excel for Windows, versions 2.x, 3.0, 4.0, 4.0a, 5.0
  • Microsoft Excel for Windows 95, version 7.0
  • Microsoft Excel for OS/2, versions 2.2, 3.0

SUMMARY

In the Open dialog box in Microsoft Excel, the default string in the File Name box is "*.XL*." (To view the Open dialog box, choose Open from the File menu.) This string causes all files with a filename extension beginning with the letters "XL" to be displayed in the list of files below the File Name box.

If you want a list of all of the files in the current directory to appear in the list of files, use one of the following methods to change the default string from "*.XL*" to "*.*".

MORE INFORMATION

To permanently change this string

Microsoft Excel versions 5.0 and 7.0

  1. In a Visual Basic module, enter the following:

       Sub Open_File()
          Application.Dialogs(xlDialogOpen).Show arg1:="*.*"
       End Sub
    
    

  2. From the File menu, choose Save As. In the File Name box, type "OPEN.XLS" (without the quotation marks), and choose OK.

    Note that you may want to save the OPEN.XLS file to the XLSTART subdirectory so that this file will be opened automatically when you start Microsoft Excel.

  3. With the module sheet still active, choose Menu Editor from the Tools menu. From the Menu Items list, select &Open..., and choose Delete. Choose the Insert button. In the Caption box, type "&Open..." (without the quotation marks). From the Macro list, select Open_File. From the Menu Bars list, select Worksheet, and choose OK.

To replace the Open command on the File menu for a chart sheet, module sheet, or when no documents are open, repeat step 3 for each of these menu bars. Note that the file OPEN.XLS that contains the Open_File macro must be available in the directory in which you saved it in step 2 to avoid receiving an error message when you choose Open from the File menu.

You may want to save the OPEN.XLS file to the XLSTART subdirectory so that this add-in will be opened automatically when you start Microsoft Excel.

Microsoft Excel version 4.0 and earlier

  1. In a macro sheet, enter the following:

    A1: Auto_Open A2: =DELETE.COMMAND(1,1,"Open...") A3: =ADD.COMMAND(1,1,B1:F1,2) A4: =RETURN() A5: A6: Open A7: =OPEN?("*.*") A8: =RETURN()

       B1: &Open... C1: OPEN.XLA!OPEN  D1:    E1:   F1: EXCELHLP.HLP!1058
    
    

  2. Select cell A1.

  3. From the Formula menu, choose Define Name. Select the Command option and choose OK.

  4. Select cell A6 and repeat step 2.

  5. From the File menu, choose Save As and select Add-In from the Save File As Type list. (In Microsoft Excel 3.0, choose Options to access the File Format list). In the File Name box, type "OPEN.XLA" (without the quotation marks).

Each time that you open the OPEN.XLA file, the Open command will be automatically altered as described above. You may want to save the OPEN.XLA file to the XLSTART subdirectory so that this add-in will be opened automatically when you start Microsoft Excel.

This setting will remain changed as long as the add-in macro you create loaded when you start Microsoft Excel.

To temporarily change this setting

Microsoft Excel versions 5.0 and 7.0

  1. In a Visual Basic module, enter the following:

          Sub Auto_Open
             SendKeys "*.*{enter}{esc}"
             Application.Dialogs(xlDialogOpen).Show
          End Sub
    
    

  2. On the Tools menu, click Make Add-In. In the File Name box, type "Open" (without the quotation marks). From the Directories list, select the XLSTART subdirectory of the Microsoft Excel directory, and choose OK.

Microsoft Excel version 4.0 and earlier

  1. In a macro sheet, type the following:

    A1: Auto_Open A2: =SEND.KEYS("%FO*.*~{esc}") A3: =RETURN()

  2. Select cell A1. From the Formula menu, choose Define Name. Select the Command option and choose OK.

  3. From the File menu, choose Save As and select Add-In from Save File As Type list. (In Microsoft Excel 3.0, choose Options to access the File Format list). In the File Name box, type "OPEN.XLA" (without the quotation marks).

This macro, invokes the keystrokes necessary to change the string in the Open dialog box from "*.XL*" to "*.*." Since this macro is saved in the startup directory, it will be started each time you start Microsoft Excel.

With this method, the setting will remain changed for the session of Microsoft Excel in which you make the change, or until you change the setting again.

The following is an explanation of keystrokes sent by the SEND.KEYS() function:

   This keystroke              Does this
   --------------------------------------------------------

   %F (Alt-F)                  Selects the File menu

   O                           Chooses the Open command from the File
                               menu

   *.*                         Sends new string

   ~                           Sends the ENTER key to confirm change

   {esc}                       Cancels the File dialog box since no
                               files are being opened at this time.

REFERENCES

"User's Guide 2," version 4.0, pages 282-294 "User's Guide 1," version 4.0, page 79 "User's Guide," version 3.0, pages 553-554, 641-652


Additional reference words: 2.1 2.10 2.1c 2.10c 2.1d 2.10d 2.2 2.20
2.21 3.0 3.00 4.0 4.00 4.0a 4.00a 5.00 7.00 howto List Files Of Type

Keywords : kbprg PgmHowTo
Version : 2.x 3.00 4.00 4.00a 5.00 7.00 |
Platform : OS/2 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: September 2, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.