Class RecentFiles (Word VBA)
A collection of RecentFile objects that represents the files that have been used recently. The items in the RecentFiles collection are displayed at the bottom of the File menu. To use a RecentFiles class variable it first needs to be instantiated, for example
Dim rfs as RecentFiles
Set rfs = RecentFiles
For Each
Here is an example of processing the RecentFiles items in a collection.
Dim rcnfl As RecentFile
For Each rcnfl In RecentFiles
Next rcnfl
Add
Returns a RecentFile object that represents a file added to the list of recently used files.
If ActiveDocument.Saved = True Then
RecentFiles.Add Document:=ActiveDocument.Name
End If
Arguments
The following argument is required
Document (Document) - The document you want to add to the list of recently used files. You can specify this argument by using either the string name for the document or a Document object.
Optional arguments
The following argument is optional
ReadOnly (Boolean) - True to make the document read-only.
Count
Returns a Long that represents the number of recent files in the collection.
Dim lngCount As Long
lngCount = RecentFiles.Count
Item
Returns an individual RecentFile object in a collection.
Item (Index)
Index: The individual object to be returned. Can be a Long indicating the ordinal position of the individual object.
Dim rcnfl As RecentFile
Set rcnfl = RecentFiles(Index:=1)
Maximum
Returns or sets the maximum number of recently used files that can appear on the File menu. Can be a number from 0 (zero) through 9.
RecentFiles.Maximum = 0