Application.DDEExecute Method

Word Developer Reference

Sends a command or series of commands to an application through the specified dynamic data exchange (DDE) channel.

Syntax

expression.DDEExecute(Channel, Command)

expression   A variable that represents an Application object. Optional.

Parameters

Name Required/Optional Data Type Description
Channel Required Long The channel number returned by the DDEInitiate method.
Command Required String A command or series of commands recognized by the receiving application (the DDE server). If the receiving application cannot perform the specified command, an error occurs.

Remarks

Security  Dynamic data exchange (DDE) is an older technology that is not secure. If possible, use a more secure alternative to DDE, such as object linking and embedding (OLE).

Example

This example creates a new worksheet in Microsoft Excel. The XLM macro instruction to create a new worksheet is New(1).

Visual Basic for Applications
  Dim lngChannel As Long

lngChannel = DDEInitiate(App:="Excel", Topic:="System") DDEExecute Channel:=lngChannel, Command:="[New(1)]" DDETerminate Channel:=lngChannel

This example runs the Microsoft Excel macro named "Macro1" in Personal.xls.

Visual Basic for Applications
  Dim lngChannel As Long

lngChannel = DDEInitiate(App:="Excel", Topic:="System") DDEExecute Channel:=lngChannel, Command:="[Run(" & Chr(34) & _ "Personal.xls!Macro1" & Chr(34) & ")]" DDETerminate Channel:=lngChannel

See Also