Macro That Will Open the Most Recently Used File in Excel

ID: Q72445


The information in this article applies to:
  • Microsoft Excel for Windows, versions 3.0, 4.0, 5.0
  • Microsoft Excel for OS/2, version 3.0


SUMMARY

The File menu in Microsoft Excel contains a list of the four most recently used files. The following macro will open the first file in that list:


   A1: =GET.BAR()
   A2: =GET.BAR(A1,"File",GET.BAR(A1,"File","file list"))
   A3: =MID(A2,4,LEN(A2)-3)
   A4: =OPEN(A3)
   A5: =RETURN() 


Explanation

A1: Finds the number of the menu bar that is currently displayed.
A2: Returns the first item from the recently used file list, exactly as it appears on the File menu.
A3: Strips off some unnecessary text that is not part of the filename.
A4: Opens the file.


REFERENCES

"Microsoft Excel User's Guide 1," version 4.0, page 55

"Microsoft Excel User's Guide 2," version 4.0, pages 289-290

"Microsoft Excel User's Guide," version 3.0, pages 73 and 649-650

Additional query words: 3.0 4.0 5.0

Keywords :
Version :
Platform :
Issue type :


Last Reviewed: March 21, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.