Class RecentFile (Excel VBA)

The class RecentFile represents a file in the list of recently used files.

The main procedures of class RecentFile are Delete, Open and RecentFiles.Add

Set

To use a RecentFile class variable it first needs to be instantiated, for example

Dim rcnfl as RecentFile
Set rcnfl = Application.RecentFiles(Index:=1)

The following procedures can be used to set variables of type RecentFile: RecentFiles.Item, RecentFiles.Add and Application.RecentFiles

For Each

Here is an example of processing the RecentFile items in a collection.

Dim rcnfl As RecentFile
For Each rcnfl In Application.RecentFiles
	
Next rcnfl

Themes

The following procedures in this class have been grouped together and are described on a separate theme page

Add with its procedures Open and RecentFiles.Add

Methods

These are the main methods of the RecentFile class

Delete - Deletes the object.

Application.RecentFiles(1).Delete

Properties

Index returns a Long value that represents the index number of the object within the collection of similar objects.

Name returns a String value that represents the name of the object.

Parent returns the parent object for the specified object. Read-only.

Path returns a String value that represents the complete path to the workbook or file that this RecentFile object represents.

RecentFiles.Count returns a Long value that represents the number of objects in the collection.

RecentFiles.Item returns a single object from a collection.

RecentFiles.Maximum returns or sets the maximum number of files in the list of recently used files. Can be a value from 0 (zero) through 50.

RecentFiles.Parent returns the parent object for the specified object. Read-only.