XL97: Macro to Change File Type to *.* in Open Dialog Box

Last reviewed: March 13, 1998
Article ID: Q161486
The information in this article applies to:
  • Microsoft Excel 97 for Windows

SUMMARY

In the Open dialog box in Microsoft Excel, the file type in the Files Of Type box is "Microsoft Excel Files (*.xl*; *.xls; *xla)" by default. This setting causes files that have a file name extension that begins with "xl" to appear in the Look In list.

To display all the files in the current directory, use a Visual Basic for Applications macro to change the default setting to "All Files (*.*)". This article explains how to change the default setting.

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.

To change the default setting in the Files Of Type box, use the following steps:

  1. Close and save any open workbooks, and then create a new workbook.

  2. Start the Visual Basic Editor (press ALT+F11).

  3. On the View menu, click Project Explorer.

If Personal.xls exists it is listed in the Explorer pane. If Personal.xls is listed, go to step 10. If it does not exist, click "Close and return to Microsoft Excel" on the File menu.

  1. On the Tools menu, point to Macros and click Record New Macro. Click "Personal Macro Workbook" in the Store Macro In list and click OK.

A Stop Recording toolbar appears.

  1. Click Stop, and then start the Visual Basic Editor (press ALT+F11).

  2. In Project Explorer, click "VBAProject(PERSONAL.XLS)" and click Module on the Insert menu.

  3. Delete the text in the module you inserted.

  4. Type the following macro:

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

  5. On the View menu, click Microsoft Excel.

  6. On the Tools menu, click Customize and click the Commands tab.

  7. On the File menu, click Open.

Note that Modify Selection in the Customize dialog is available.

  1. In the Customize dialog box, click Modify Selection.

"&Open" appears in the Name box.

  1. Click Assign Macro, click "PERSONAL.XLS!Open_File" and click OK.

  2. On the Workbook menu, click File.

This step causes the File menu to disappear.

  1. Click File Open on the Standard toolbar and repeat steps 12 and 13.

The selected name referred to in step 12 should be "Open".

  1. In the Customize dialog box, click Close.

  2. On the File menu, click Exit. When you are prompted to save changes to

        Personal.xls, click Yes. If you are prompted to save changes to Book1,
        click No.
    

REFERENCES

For more information about built-in menus, click the Index tab in Microsoft Excel Help, type the following text

   menus, built-in

and then double-click the selected text to go to the "Add a built-in menu to a toolbar " topic.


Additional query words: XL97
Keywords : kbcode kbprg kbualink97 xlvbahowto xlvbainfo xlloadsave xlui
Version : WINDOWS: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: March 13, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.