Accessing Smart Document Controls [Office 2003 SDK Documentation]
The following list provides basic information about the members of the Microsoft Visual Basic for Applications (VBA) object model that are useful when interacting with controls that are rendered in the Document Actions task pane.
For more information about these objects, collections, properties, and methods, see the Microsoft Office 2003 VBA Help that was installed with Microsoft Office.
Collections
SmartTags The SmartTags property returns a SmartTags collection that includes all XML elements that have associated actions within your smart document.
Use Item(Index) to access a specific smart tag within a document, where Index can be either a 1-based integer that represents the position of the smart tag or XML element in the SmartTags collection or a specific XML element in "namespace#tagname" format.
The SmartTags property is a member of the Document object and Range object in Microsoft Office Word 2003, and the Worksheet object and Range object in Microsoft Office Excel 2003.
SmartTagActions The SmartTagActions property returns a SmartTagActions collection that includes all smart document controls that are associated with a specified XML element (or SmartTag object).
Use Item(Index) to access a specific smart document control, where Index can be either a 1-based integer that represents the position of the control in the SmartTagActions collection or the name of the smart document control defined within the ISmartDocument ControlNameFromID property.
The SmartTagActions property is a member of the SmartTag object in both Word and Excel.
Note If you delete or detach an XML expansion pack from a document in Excel, the SmartTags and SmartTagActions collections are not updated. Therefore, you may get a run-time error if you try to execute actions on a smart tag that doesn't exist.
Properties and methods
The following properties and methods are members of the SmartTagAction object:
ActiveXControl The ActiveXControl property provides access to ActiveX controls that are used in your smart document by returning the ActiveX control as an object. For more information about how to access ActiveX controls from the object model, see the topic "Adding ActiveX Controls" in the Tutorials section (select the programming language you need).
Note This property is valid only for controls of type C_TYPE_ACTIVEX.
CheckboxState The CheckboxState property provides access to the state of check box controls used in your smart document and allows you to set or return a Boolean value that represents the state of the control. True indicates that the check box is selected (checked); False indicates it is not selected (unchecked).
Note This property is valid only for controls of type C_TYPE_CHECKBOX.
Execute The Execute method allows smart document controls to be invoked without user interaction in the Document Actions task pane. For example, you could use the Execute method to automatically execute the code for a specific control within the InvokeControl method in the ISmartDocument interface.
ExpandDocumentFragment The ExpandDocumentFragment property provides access to the state of document fragment controls in your smart document and allows you to set or return a Boolean value that represents whether the document fragment is expanded or collapsed. True indicates a document fragment is expanded; False indicates it is not.
Note This property is valid only for controls of type C_TYPE_DOCUMENTFRAGMENT and C_TYPE_DOCUMENTFRAGMENTURL. Document fragments are only available for smart documents hosted in Microsoft Office Word 2003.
ExpandHelp The ExpandHelp property provides access to the state of Help controls and sets or returns a Boolean value that represents whether the Help control is expanded or collapsed. True indicates the control is expanded; False indicates that it is not.
Note This property is valid only for controls of type C_TYPE_HELP and C_TYPE_HELPURL.
ListSelection The ListSelection property provides access to the state of list box and combo box controls in a smart document and sets or returns an Integer that represents the index of the currently selected item.
Note This property is valid only for controls of type C_TYPE_LISTBOX and C_TYPE_COMBOBOX.
Name The Name property returns the name of a smart document control, as defined using the ControlNameFromID property in the ISmartDocument interface.
PresentInPane The PresentInPane property returns a Boolean value that allows smart document developers to determine whether a control is currently in scope. True indicates that the control is currently displayed in the Document Actions task pane; False indicates it is not.
RadioGroupSelection The RadioGroupSelection property provides access to the state of radio group controls in the smart document and sets or returns an Integer that represents the currently selected item.
Note This property is valid only for controls of type C_TYPE_RADIOGROUP.
TextboxText The TextboxText property provides access to the state of text box controls in the smart document and sets or returns a String that represents the text in the control.
Note This property is valid only for controls of type C_TYPE_TEXTBOX.
Type The Type property returns an Integer that specifies the type of control.