The Name Properties

The Document object has three properties related to the filename of the document, all of them read-only:

The Name property

Returns the name of the document. This will be the default name if the document has not yet been saved. Since this property is read-only, you cannot change the name of a document by setting this property. (A Word document that is not open can be renamed using the VBA Name statement; if the document is open, you can save it under a different name using the SaveAs method, but you cannot rename it.)

The FullName property

Returns the complete path and filename of the document. If the document has not yet been saved, however, this property will return the same value as the Name property.

The Path property

Returns the path (but not the filename) of the document, without the trailing backslash.

Get Writing Word Macros, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.