DDEExecute Method

Applies To

Application object, Global object.

Description

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

Syntax

expression.DDEExecute(Channel, Command)

expression Optional. An expression that returns an Application object.

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.

See Also

DDEPoke method.

Example

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

chan = DDEInitiate(App:="Excel", Topic:="System")
DDEExecute Channel:=chan, Command:="[New(1)]"
DDETerminate Channel:=chan
This example runs the Microsoft Excel macro named "Macro1" in Personal.xls.

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