DdeExecute

Sends a command or series of commands to a dynamic-data exchange (DDE) application.

Syntax

DdeExecute "appName", "topic", "command"[, async]

Argument Description
appName The name of the DDE application receiving the command. The appName value is usually the name of the application's .EXE file without the file name extension. The application must be running.
topic The name of a topic recognized by the application. Many DDE applications recognize a topic named "System", which is always available. Each open document may also be a separate topic.
command A command or series of commands recognized by the DDE application. Most applications require that each command received through a DDE channel be enclosed in square brackets. See Examples. Do not include spaces between bracketed commands.
async If 0 or omitted, this call is synchronous and waits until the DDE application acknowledges completion or a timeout occurs. If 1, this call is asynchronous and returns immediately.

Example 1

This example opens a channel to Microsoft Excel and the System topic, and then sends a command to open EXPENSES.XLS. The document name must be enclosed in two sets of quotation marks.

DdeExecute "Excel", "System", "[OPEN(""Expenses.xls"")]"

Example 2

This example tells Microsoft Word to decrease the font size of selected text.

DdeExecute "WinWord", "System", "[ShrinkFont]"

Notes

  • Use a DdeExecute instruction instead of SendKeys if you cannot be sure a key sequence always produces the same result. A key sequence can have different results depending on whether it is received by the application window or an open dialog box.
  • Set async to 1 if you are calling a DDE command that does not return immediately. Otherwise, if the DDE command does not return quickly, DdeExecute fails with a timeout error and Dragon displays an error message.