DDETerminateAll Method Example

This example opens the Microsoft Excel workbook Book1.xls, inserts text into cell R2C3, saves the workbook. and then terminates all DDE channels.

chan = DDEInitiate(App:="Excel", Topic:="System")
DDEExecute Channel:=chan, Command:="[OPEN(" & Chr(34) & _
    "C:\My Documents\Book1.xls" & Chr(34) & ")]"
DDETerminate Channel:=chan
chan = DDEInitiate(App:="Excel", Topic:="Book1.xls")
DDEPoke Channel:=chan, Item:="R2C3", Data:="Hello World"
DDEExecute Channel:=chan, Command:="[Save]"
DDETerminateAll