Export (0) Print
Expand All

Application.DDEExecute Method (Word)

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

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.

Security noteSecurity Note
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).

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
Show:
© 2014 Microsoft