Share via


CustomProperty Object

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

CustomProperties
Aa661377.parchild(en-us,office.10).gifCustomProperty

Represents identifier information. Identifier information can be used as metadata for XML.

Using the CustomProperty object

Use the Add method or the Item property of the CustomProperties collection to return a CustomProperty object.

Once a CustomProperty object is returned, you can add metadata to worksheets using the CustomProperties property with the Add method.

The following example demonstrates this feature. In this example, Microsoft Excel adds identifier information to the active worksheet and returns the name and value to the user.

  Sub CheckCustomProperties()

    Dim wksSheet1 As Worksheet

    Set wksSheet1 = Application.ActiveSheet

    ' Add metadata to worksheet.
    wksSheet1.CustomProperties.Add _
        Name:="Market", Value:="Nasdaq"

    ' Display metadata.
    With wksSheet1.CustomProperties.Item(1)
        MsgBox .Name & vbTab & .Value
    End With

End Sub