Syntax
DocumentPropertyName$(PropertyNumber)
Remarks
Returns the name of the document property as specified by PropertyNumber. Word lists the built-in properties first. The custom properties are appended at the end the list. Use the DocumentPropertyExists() function to verify that the property specified by PropertyNumber exists. In Word version 6.0, DocumentPropertyName$() is unavailable and generates an error.
The following table lists the built-in properties available in Word for the active document. The list indicates which of these properties are read-only.
Property name | Explanation |
Title | The title of the document |
Subject | The subject of the document |
Author | The author of the document |
Manager | The name of the manager |
Company | The name of the company |
Category | The category of the document |
Keywords | The keywords used to identify the document |
Comments | The comments about the document |
Template | The document template (read-only) |
CreateTime | The creation date (read-only) |
LastSavedTime | The date the document was last saved (read-only) |
LastPrinted | The date the document was last printed (read-only) |
LastSavedBy | The name of the person who last saved the document (read-only) |
RevisionNumber | The number of times that the document has been saved (read-only) |
TotalEditingTime | The total time that the document has been open, in minutes, as a number (read-only) |
Pages | The number of pages (read-only) |
Paragraphs | The number of paragraphs (read-only) |
Lines | The number of lines (read-only) |
Words | The number of words (read-only) |
Characters | The number of characters (read-only) |
Property name | Explanation |
Bytes | The size of the document, in the form "36,352 Bytes" (read-only) |
NameOfApplication | The name of the associated application; for example, "Microsoft Word for Windows 95" (read-only) |
Security | The level of document protection (read-only) |
Example
This example inserts a list of all the document properties at the end of the current document. Property names are inserted with bold formatting, and each one is followed by its value.
EndOfDocument InsertPara For count = 1 To CountDocumentProperties() a$ = DocumentPropertyName$(count) Bold 1 : Insert a$ InsertPara If DocumentPropertyType(a$) = 1 then b = GetDocumentProperty(a$) Bold 0 : Insert Str$(b) InsertPara : InsertPara Else b$ = GetDocumentProperty$(a$) Bold 0 : Insert b$ InsertPara : InsertPara End If Next
See Also
CountDocumentProperties(), DocumentPropertyType(), GetDocumentProperty(), IsDocumentPropertyReadOnly(), SetDocumentProperty