Item Method (DocumentProperties Collection)

Applies To

DocumentProperties Collection.

Description

Accessor. Returns a single DocumentProperty object from the collection of document properties.

To use this method, you should establish a reference to the Microsoft Office 95 Object Library by using the References command (Tools menu).

Remarks

Because the Item method is the default method for the DocumentProperties collection object, the following statements are identical.


CustomDocumentProperties.Item(1)
CustomDocumentProperties(1)

You can refer to document properties either by index value or by name. The following list shows the available built-in document property names:

Title, Subject, Author, Keywords, Comments, Template, Last Author, Revision Number, Application Name, Last Print Date, Creation Date, Last Save Time, Total Editing Time, Number of Pages, Number of Words, Number of Characters, Security, Category, Format, Manager, Company, Number of Bytes, Number of Lines, Number of Paragraphs, Number of Slides, Number of Notes, Number of Hidden Slides, Number of Multimedia Clips

Container applications aren't required to define values for every built-in document property. If the application doesn't define a value for one of the built-in document properties, reading the Value property for that document property causes an error.

Example

This example displays the names of the document properties in a collection. You must pass a DocumentProperties collection to the procedure.


Sub DisplayPropertyNames(dp As DocumentProperties)
    Dim i As Integer
    For i = 1 To dp.Count
        MsgBox dp.Item(i).Name
    Next
End Sub

This example creates a list containing the names of the built-in document properties in the active workbook.


Set wk = Worksheets(1)
Set builtinProps = ActiveWorkbook.BuiltinDocumentProperties
For i = 1 To builtinProps.Count
    wk.Cells(i, 1).Value = builtinProps.Item(i).Name
Next