O'Reilly logo

Writing Word Macros, Second Edition by Steven Roman PhD

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required