CustomProperties Collection
CustomProperty
A collection of CustomProperty objects that represent additional information. The information can be used as metadata for XML.
Using the CustomProperties collection
Use the Properties property of the SmartTag object, or the CustomProperties property of the Worksheet object, to return a CustomProperties collection.
Once a CustomProperties collection is returned, you can add metadata to worksheets and smart tags depending on which you choose to work with.
To add metadata to a worksheet, use 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
To add metadata to a smart tag, use the Properties property with the Add method.
The following example demonstrates this feature. In this example, Microsoft Excel adds a smart tag titled "MSFT" to cell A1, then adds extra metadata called "Market" with the value of "Nasdaq" to the smart tag and then returns the value of the property to the user. This example assumes the host system is connected to the Internet when running this code sample and the checked recognizer called "Stock Ticker Symbol Recognizer" is enabled for Microsoft Excel.
Sub UseProperties()
Dim strLink As String
Dim strType As String
' Define smart tag variables.
strLink = "urn:schemas-microsoft-com:smarttags#stocktickerSymbol"
strType = "stockview"
Range("A1").Formula = "MSFT"
' Add a property for MSFT smart tag and define its value.
Range("A1").SmartTags.Add(strLink).Properties.Add _
Name:="Market", Value:="Nasdaq"
' Notify the user of the smart tag's value.
MsgBox Range("A1").SmartTags.Add(strLink).Properties("Market").Value
End Sub