DDEExecute 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