SmartTagAction Object
Represents a single action for a smart tag. Smart tag actions are processes that are programmed into smart tags that allow users to perform certain functions related to the smart tag. For example, one action for a smart tag might be to access a Web site, while another action inserts contact information into Microsoft Outlook, while yet another displays a map and driving directions.
Smart tag actions also relate to actions built into smart documents and to the controls in the Document Actions task pane. For example, you might have a textbox control displayed in the task pane for a smart document that performs an action when a user changes the contents of the text box.
Note SmartTagRecognizer, SmartTagAction, and SmartTagType objects are related in that each item that a smart tag component recognizes is a SmartTagType object. For example, "city" in the Address smart tag component is a specific SmartTagType object. The city smart tag type has related SmartTagRecognizer objects (the part of the smart tag component that recognizes smart tags of type "city" in documents) and SmartTagAction objects (the part of the smart tag component that provides the actions related to the specific smart tag type, which may include looking up a recognized city in Microsoft MapPoint on MSN). Put simply, the recognizer does the labeling, the action handler provides end-user functionality, and what ties them together is the type of smart tag they work on.
Using the SmartTagAction Object
Use the Item method to return an individual SmartTagAction object from a SmartTagActions collection. The following example accesses the first smart tag action in the first smart tag in the active document.
ActiveDocument.SmartTags(1).SmartTagActions.Item(1)
Note that the Item method is the default member for the SmartTagAction object. So the previous example could also be written as shown below to return the same SmartTagAction object.
ActiveDocument.SmartTags(1).SmartTagActions(1).TextboxText
Use the Type property to determine the type of control associated with a SmartTagAction object. The following example determines whether the specified smart tag action is a help control, which is help text displayed in the Document Actions task pane associated with a smart document; if it is, the example expands the help to show the entire help text and not just the caption for the help text.
Sub ExpandHelp()
Dim wdActionType As WdSmartTagControlType
Dim objSTAction As SmartTagAction
Set objSTAction = ActiveDocument.SmartTags(1).SmartTagActions(1)
If objSTAction.Type = wdControlHelp Then
objSTAction.ExpandHelp = True
End If
End Sub