RecentFiles.Add method (Word)

Returns a RecentFile object that represents a file added to the list of recently used files.


expression.Add (Document, ReadOnly)

expression Required. A variable that represents a 'RecentFiles' collection.


Name Required/Optional Data type Description
Document Required Variant 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.
ReadOnly Optional Variant True to make the document read-only.

Return value



This example adds the active document to the list of recently used files.

If ActiveDocument.Saved = True Then 
 RecentFiles.Add Document:=ActiveDocument.Name 
End If

See also

RecentFiles Collection Object

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.