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 strName As String: strName =
Dim rcnfl As RecentFile
Set rcnfl = Application.RecentFiles.Add(Name:=strName)
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 rcnflRecentFile As RecentFile
For Each rcnflRecentFile In Application.RecentFiles
Next rcnflRecentFile
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.
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.
Application.RecentFiles.Item(2).Open
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.
Application.RecentFiles.Maximum = 6
RecentFiles.Parent returns the parent object for the specified object. Read-only.