Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

How to: Programmatically List Recently Used Workbook Files

The RecentFiles property returns a collection that contains the names of all the files that appear in the Microsoft Office Excel list of recently used files. The length of the list varies depending on the number of files the user has selected to retain. You can display the results in a range.

Applies to: The information in this topic applies to document-level projects and application-level projects for Excel 2013 and Excel 2010. For more information, see Features Available by Office Application and Project Type.

To list recently used workbooks in a range object

  • Loop through the list of recent files and display the names in cells relative to a Microsoft.Office.Interop.Excel.Range object.

    Excel.Range rng = this.Application.get_Range("A1");
    for(int i=1; i<=this.Application.RecentFiles.Count; i++)
        rng.get_Offset(i - 1,0).Value2 = this.Application.RecentFiles.get_Item(i).Name;
© 2015 Microsoft