DDE

(Engine-Level Function)

Description: Returns the value of the data for a specific item from a DDE server program. This function is a DDE client.
Returns: Varies
Usage: Steady State only.
Function Groups: DDE
Related to: DDEPoke | DDEShareAdd | DDEShareDel | SetDDEServer
Format: DDE(Program, Topic, Item[, Error, Trigger, pollTimeOut])
Parameters:  
Program  

Required. Any text expression giving the name of the program which is the DDE server. This does not contain the .EXE extension. This is usually the same as the root file name of the executable file, but may be different as in the case of Microsoft Word for Windows 6.0 which uses the name "MSWord".

Topic  

Required. Any text expression giving the DDE topic name within the server. For a VTScada server the topic name is usually the name of the window. For Microsoft Excel, the topic is the spreadsheet name.

Item  
Required. Any text expression giving the location or name of the value to retrieve.
Error  
Optional. A variable that will be set when an error occurs. Values may be as follows: 0=OK, -1=DDE is stopping, -2=FAILED
Trigger
Optional. If present, this indicates a "COLD" link as opposed to a "HOT" link (i.e. you have to poll the server to get an update, rather than it pushing updates to you).

When set to 1, this triggers a poll. The trigger is then reset.
pollTimeOut  
Optional. If this is a COLD link (see Trigger) then pollTimeOut is the value in seconds of the time out for the poll.
Comments:

Due to numerous security problems, DDE has been disabled by default in Microsoft Office applications since 2017. If you must use this technology, do so with extreme care!

This sets up a DDE client. After the link is established, the return value of the function will change whenever the value in the DDE server changes.

Example:

  cellValue = DDE("Excel", "Sheet1", "R1C1");

Upon execution of this statement, cellValue will contain the value of the cell in row 1, column 1 of the Excel spreadsheet called "Sheet1".