Purpose
Issues a command across an open DDE channel.
Syntax
DDEExecute channel, command
channel is an integer channel number returned by DDEInitiate().
command is a string representing a command for the DDE server to execute.
Description
The DDEExecute statement sends a command string to the server application in a DDE conversation.
The channel parameter must correspond to the number of a channel opened through a DDEInitiate() function call.
The command parameter string must represent a command which the DDE server (the passive application) is able to carry out. Different applications have different requirements regarding what constitutes a valid command; to learn about the command format for a particular application, see the documentation for that application.
Error Conditions
ERR_CMD_NOT_SUPPORTED (642) error generated if not running on Windows.
ERR_NO_RESPONSE_FROM_APP (697) error if server application does not respond.
Example
Through MapBasic, you can open a DDE channel with Microsoft Excel as the server application. If the conversation specifies the "System" topic, you can use the DDEExecute statement to send Excel a command string. Provided that the command string is equivalent to an Excel macro function, and provided that the command string is enclosed in square brackets, Excel can execute the command. The example below instructs Excel to open the worksheet "TRIAL.XLS".
Dim i_chan As Integer
i_chan = DDEInitiate("Excel", "System")
DDEExecute i_chan, "[OPEN(""C:\DATA\TRIAL.XLS"")]"
See Also:
DDEInitiate() function, DDEPoke statement, DDERequest$() function