See Also Example
Asks the source in a dynamic data exchange
Syntax
control.LinkRequest
Remarks
The control is the name of a text box, picture box, or label involved in a DDE conversation as a destination. LinkRequest causes the source application to provide fresh data to the control, updating the Text property if the control is a text box, the Picture property if the control is a picture box, or the Caption property if the control is a label.
If the LinkMode property of the control is set to Automatic (1), the source application will automatically update the control and LinkRequest is not needed. If the LinkMode property of the control is set to Manual (2), the source application will only update the control when requested to with the LinkRequest method. If the LinkMode property of the control is set to Notify (3), the source will notify the destination that data has changed by causing the LinkNotify event to occur. The destination must then use LinkRequest to actually update the data.
LinkExecute Method
LinkMode Property
LinkNotify Event
LinkPoke Method
LinkSend Method
The example uses LinkRequest to update the contents of a text box with the values in a Microsoft Excel worksheet. To try this example, you must have Microsoft Excel running on your computer. Place some data in the first cells in the first column in the default worksheet (called Sheet1.XLS). Paste the code shown below into the Declarations section of a form that has a text box control called Text1. Then press F5 and click the form.
Sub Form_Click ()
Const NONE = 0, LINK_MANUAL = 2 ' Declare constants.
If Text1.LinkMode = NONE Then ' Test link mode.
Text1.LinkTopic = "Excel|Sheet1" ' Set link topic.
Text1.LinkItem = "R1C1" ' Set link item.
Text1.LinkMode = LINK_MANUAL ' Set link mode.
Text1.LinkRequest ' Update text box
Else
If Text1.LinkItem = "R1C1" Then
Text1.LinkItem = "R2C1"
Text1.LinkRequest ' Update text box.
Else
Text1.LinkItem = "R1C1"
Text1.LinkRequest ' Update text box.
End If
End If
End Sub