LinkTopic Property

       

For a destination control — returns or sets the source application and the topic (the fundamental data grouping used in that application). Use LinkTopic with the LinkItem property to specify the complete data link.

For a source form — returns or sets the topic that the source form responds to in a DDE conversation.

Syntax

object.LinkTopic [= value]

The LinkTopic property syntax has these parts:

Part Description
object An object expression that evaluates to an object in the Applies To list.
value A string expression specifying a DDE syntax element.

Remarks

The LinkTopic property consists of a string that supplies part of the information necessary to set up either a destination link or source link. The string you use depends on whether you're working with a destination control or a source form. Each string corresponds to one or more elements of standard DDE syntax, which include application, topic, and item.

Note   While the standard definition for a DDE link includes the application, topic, and item elements, the actual syntax used within applications for a destination link to a source application may vary slightly. For example, within Microsoft Excel, you use the syntax:

application|topic!item

Within Microsoft Word for Windows, you use:

application topic item

(Don't use the pipe character [|] or exclamation mark [!].)

Within a Visual Basic application, you use:

application|topic

The exclamation mark for topic is implicit.

Destination Control To set LinkTopic for a destination control, use a string with the syntax application|topic as follows:

In addition, for a destination control only, you must set the related LinkItem property to specify the item element for the link. A cell reference, such as R1C1, corresponds to an item in a Microsoft Excel worksheet.

Source Form To set LinkTopic for a source form, set value to an appropriate identifier for the form. A destination application uses this string as the topic argument when establishing a DDE link with the form. Although this string is all you need to set LinkTopic within Visual Basic for a source form, the destination application also needs to specify:

The following syntax is an example of a valid reference from Microsoft Excel to a Visual Basic application acting as a source:

=VizBasicApplication|FormN!TextBox1

You could enter this reference for a destination cell in the Microsoft Excel formula bar.

To activate the data link set with LinkTopic, set the LinkMode property to the appropriate nonzero value to specify the type of link you want. As a general rule, set LinkMode after you set LinkTopic. For a destination control, changing LinkTopic breaks an existing link and terminates the DDE conversation. For a source form, changing LinkTopic breaks all destination links that are using that topic. For these reasons, always set the LinkMode property to 0 before changing LinkTopic. After changing LinkTopic for a destination control, you must set LinkMode to 1 (Automatic), 2 (Manual), or 3 (Notify) to establish a conversation with the new topic.

Note   Setting a permanent data link at design time with the Paste Link command on the Edit menu also sets the LinkMode, LinkTopic, and LinkItem properties. This creates a link that is saved with the form. Each time the form is loaded, Visual Basic attempts to reestablish the conversation.