See Also Example
Applies To
Form, MDI Form
Description
Occurs when a command string is sent by a destination
Syntax
Sub { Form|MDIForm}_LinkExecute (CmdStr As String, Cancel As Integer)
Remarks
The LinkExecute event uses these arguments:
Argument Description
CmdStr The command string sent by the destination application.
Cancel This argument's value at the end of the LinkExecute event procedure tells the destination whether the command string was accepted or refused. Setting Cancel = 0 informs the destination that the command string was accepted. Setting Cancel to any nonzero value informs the destination that the command string was rejected. (The default is set to -1, indicating Cancel.)
There is no required syntax for CmdStr. How your application responds to different strings is completely up to you.
If you have not created a LinkExecute event procedure, Visual Basic rejects command strings from destination applications.
Help:
Attaching an Event Procedure to a Form or Control
LinkClose Event
LinkError Event
LinkExecute Method
LinkMode Property
LinkNotify Event
LinkOpen Event
LinkTopic Property
Using DDE
Programmer's Guide:
Chapter 20, "Communicating with Other Applications"
The example defines a set of commands for destinations to use in DDE conversations to which your application will respond. This example is for illustration only.
Sub Form_LinkExecute (CmdStr As String, Cancel As Integer)
Cancel = False
Select Case LCase(cmdStr)
Case "{ big}"
WindowState = 2 ' Maximize window.
Case "{ little}"
WindowState = 1 ' Minimize window.
Case "{ hide}"
Visible = False ' Hide form.
Case "{ view}"
Visible = True ' Display form.
Case Else
Cancel = True ' Execute not allowed.
End Select
End Sub