CustomProperties.Add Method

Excel Developer Reference

Adds custom property information.

Syntax

expression.Add(Name, Value)

expression   A variable that represents a CustomProperties object.

Parameters

Name Required/Optional Data Type Description
Name Required String The name of the custom property.
Value Required Variant The value of the custom property.

Return Value
A CustomProperty object that represents the custom property information.

Example

This example adds identifier information to the active worksheet and returns the name and value to the user.

Visual Basic for Applications
  Sub CheckCustomProperties()
Dim wksSheet1 As Worksheet

Set wksSheet1 = Application.ActiveSheet

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

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

End Sub

See Also