DDERequest Method Example

This example opens the Microsoft Excel workbook Book1.xls and retrieves the contents of cell R1C1.

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")
MsgBox DDERequest(Channel:=chan, Item:="R1C1")
DDETerminateAll

This example opens a channel to the System topic in Microsoft Excel and then uses the Topics item to return a list of available topics. The example inserts the topic list, which includes all open workbooks, after the selection.

aChan = DDEInitiate(App:="Excel", Topic:="System")
topicList = DDERequest(Channel:=aChan, Item:="Topics")
Selection.InsertAfter topicList
DDETerminate Channel:=aChan