RecentFile Object

RecentFile Object
This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

RecentFiles
Aa679621.parchild(en-us,office.10).gifRecentFile
Aa679621.space(en-us,office.10).gifAa679621.parchild(en-us,office.10).gifDocument

Represents a recently used file. The RecentFile object is a member of the RecentFiles collection. The RecentFiles collection includes all the files that have been used recently. The items in the RecentFiles collection are displayed at the bottom of the File menu.

Using the RecentFile Object

Use RecentFiles(index), where index is the index number, to return a single RecentFile object. The index number represents the position of the file on the File menu. The following example opens the first document in the RecentFiles collection.

  If RecentFiles.Count >= 1 Then RecentFiles(1).Open

Use the Add method to add a file to the RecentFiles collection. The following example adds the active document to the list of recently-used files.

  If ActiveDocument.Saved = True Then
    RecentFiles.Add Document:=ActiveDocument.FullName, _
        ReadOnly:=True
End If

Remarks

The SaveAs and Open methods include an AddToRecentFiles argument that controls whether or not a file is added to the recently-used-files list when the file is opened or saved.