Understanding Custom Document Properties in Microsoft Office Word 2003

Summary: Learn the details of using document properties in Word with emphasis on custom document properties. These properties provide a powerful way to add and track specific information for a document. (5 printed pages)

Frank Rice, Microsoft Corporation

January 2004

Applies to: Microsoft Office Word 2003


  • Overview

  • Types of Document Properties

  • Working with Document Properties

  • Document Property Collection, Objects, and Properties

  • Example of Creating a Custom Property

  • Setting and Retrieving Custom Properties

  • Conclusion


Document properties, both built-in and custom, are a Microsoft Office-wide feature. That is, programs such as Microsoft Office Word 2003, Microsoft Office Access 2003, and Microsoft Office Excel 2003 that produce Office documents, expose document properties and provide the same way to work with them.


Although this article focuses on document properties for Word 2003, document properties were introduced in Microsoft Word 97.

The purpose of document properties is to provide a common way to describe any document. Document properties are details, or metadata, about a file that help identify it — for example, a descriptive title, the author name, the subject, and keywords that identify topics or other important information in the file. Custom properties extend this functionality by allowing you to define your own properties.

Types of Document Properties

There are four main types of document properties as follows:

  • Automatically updated properties include statistics that are maintained for you by Office programs, such as file size and the dates files are created and last modified.

  • Preset properties already exist (such as author, title, and subject), but you must add a text value. For example, in Word, you use the Keywords property to add the keyword "customers" to your sales files and then search for all sales files with that keyword.

  • Custom properties are properties you define. You can assign a text, time, or numeric value to custom properties, and you can assign them the values "yes" or "no." You can choose from a list of suggested names or define your own.

  • Document library properties are for files in a document library on a Web site or public folder. When you design a document library, you define one or more document library properties and set rules on their values. When users add documents to the document library, they are prompted to fill in a form assigning values to each of these properties.


    A document library is a folder where a collection of files is shared and the files often use the same template. Each file in a library is associated with user-defined information that is displayed in the content listing for that library.

This article focuses on custom properties.

Working with Document Properties

In Word, you work with document properties either through the user interface or programmatically. We'll discuss working with custom properties programmatically shortly. To view document properties from a currently open document, on the File menu, click Properties.

To view document properties from the Open dialog box:

  1. On the Standard toolbar, click Open.

  2. In the Open dialog box, select the document for which you want to view properties.

  3. On the Views menu, do any of the following:

    • To preview the contents of the file before opening it, click Preview.

    • To view such properties as the size of the file and the date the file was last modified, click Details.

    • To view all document properties, click Properties.

Regardless which method you use to view the document properties, you view the custom properties by clicking on the Custom tab (see Figure 1).

Figure 1. The custom properties tab of the Document Properties dialog box

The Custom tab of the Properties dialog box

Properties are assigned a name, a data type (Text, Date, Boolean, or Number), and a value. The names provide in the list are just a suggestion. You can add any name that you want as long as it is not already in use.

Document Property Collection, Objects, and Properties

The following are the various objects that are used to work with document properties programmatically:

DocumentProperties Collection Object

Represents a collection of DocumentProperty objects. Each DocumentProperty object represents a built-in or custom property of a container document.

Use the Add method to create a custom property and add it to the DocumentProperties collection. You cannot use the Add method to create a built-in document property.

DocumentProperty Object

Represents a custom or built-in document property of a container document. The DocumentProperty object is a member of the DocumentProperties collection.


Returns a DocumentProperties collection representing all of the Word defined attributes of the document.

Use BuiltinDocumentProperties(index), where index is the index number of the built-in document property, to return a single DocumentProperty object that represents a specific built-in document property.

Table 1. A list of the names of all the available built-in document properties


Number of Words


Number of Characters









Last Author


Revision Number

Number of Bytes

Application Name

Number of Lines

Last Print Date

Number of Paragraphs

Creation Date

Number of Slides

Last Save Time

Number of Notes

Total Editing Time

Number of Hidden Slides

Number of Pages

Number of Multimedia Clips


Returns the DocumentProperties collection, allowing manipulation and addition of custom document properties.

Use CustomDocumentProperties(index), where index is the number of the custom document property, to return a DocumentProperty object that represents a specific custom document property.

Example of Creating a Custom Property

As stated earlier, you create a custom document property through the user interface or through the Add method of the CustomDocumentProperties collection as follows:

Dim objCustomProperties As DocumentProperties

Set objCustomProperties = ActiveDocument.CustomDocumentProperties
objCustomProperties.Add Name:="ProductCode"_
   Type:=msoPropertyTypeNumber, Value:=104, _

The Type argument can be one of the following:

  • msoPropertyTypeNumber, for integer values

  • msoPropertyTypeFloat, for real numbers

  • msoPropertyTypeBoolean, for True/False values

  • msoPropertyTypeDate, for date/time values

  • msoPropertyTypeString, for text values

Setting and Retrieving Custom Properties

You also use the same CustomDocumentProperties collection that you used to create the custom property to get or set their values. The specific property are accessed using an index value which can be the numeric denoting the properties relative position in the collection or the name of the property. Using the name value is preferred over the numeric index as the numeric index of a specific property changes as other properties are added or removed. Note that the maximum length of a custom property name is 256 characters:

ProductCode = objCustomProperties("ProductCode").Value


Custom document properties provide a powerful method for storing specific information with any document. It is often used to store company information and personal tracking data. You can also use custom document properties to track information for a document management system manually or programmatically.