Opening a DDE Channel

 

Most applications use three elements to identify a specific DDE operation: the app, the name of the application, the topic, the basic data grouping, and the item, the specific data within the topic. In the above example, the app is Excel, the topic is Sheet1, an Excel Worksheet and the data item is R1C1, cell A1 ( Excel uses row column notation for cell references in DDE operations).

 

The DDEINIT function opens a channel to a specific application and topic. The topic is often a document open in the application. The item field is rarely required to initiate a conversation. DDEINIT can also start the application if it is not already running. For example,

 

 ddeinit("Excel", "Sheet1", "", "C:excelexcel", 1)

 

starts Excel and establishes a DDE link. The third string is an optional item and is not required in this example, therefore it is left blank. The fourth string, C:excelexcel, is the executable name of the application. Note the executable name is often different from the application's DDE name. The last argument of 1 tells DADiSP to automatically start the application if it is not already running.

 

DDEINIT also accepts app, topic and item strings in one string in the form of app|topic!item. Thus, the above example, which does not specify an item, could be written as:

 

 ddeinit("Excel|Sheet1", "C:\excel\excel", 1)

 

 Note: examples tested in Excel Version 4.