Share via


SmartTags.Add Method

Excel Developer Reference

Adds a smart tag. Returns a SmartTag object.

Syntax

expression.Add(SmartTagType)

expression   A variable that represents a SmartTags object.

Parameters

Name Required/Optional Data Type Description
SmartTagType Required String The type of smart tag.

Return Value
A SmartTag object that represents a new smart tag.

Example

This example 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.

Visual Basic for Applications
  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.<strong>Add</strong>(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

See Also