Partager via


RecentFiles.Add Method (Word)

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

Syntax

expression .Add(Document, ReadOnly)

expression Required. A variable that represents a RecentFiles collection.

Parameters

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

RecentFile

Example

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

Concepts

RecentFiles Collection Object

RecentFiles Object Members