Application.DDEExecute method (Word)
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
Example
This example creates a new worksheet in Microsoft Excel. The XLM macro instruction to create a new worksheet is New(1).
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.
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
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.