Dynamic data exchange (DDE) is a mechanism that permits two applications to communicate by automatically and continuously exchanging data. Many applications that don't yet support OLE Automation support DDE. To run a DDE conversation between applications, you establish a channel, select a topic, request and send data, and then close the channel when you finish exchanging data. The following table lists the tasks that Microsoft Excel performs with DDE and the method used for each task.
Task |
Method |
Starting DDE |
DDEInitiate |
Getting text from another application |
DDERequest |
Sending text to another application |
DDEPoke |
Carrying out a command in another application |
DDEExecute |
Ending DDE |
DDETerminate |
Note
Not all applications support DDE. To find out whether an application supports DDE, see the documentation for that application.
The following procedure uses most of the DDE calls explained in the preceding table. The DemoDDE() procedure places the text string "I'm here" in cell A1 on Sheet1 of the active workbook.
Sub DemoDDE() Set dataCell = ActiveWorkbook.Worksheets("Sheet1").Range("A1") dataCell.Value = "I'm here!" ChannelNumber = Application.DDEInitiate("DDE", "Form1") Application.DDEPoke ChannelNumber, "Text1", dataCell Application.DDETerminate ChannelNumber End Sub