Using CitectSCADA > Exchanging Data with Other Applications > Using DDE (Dynamic Data Exchange) > Writing values to a DDE application

Writing values to a DDE application

To write a CitectSCADA variable value directly to an external DDE server application currently running on the same computer as CitectSCADA, use the Cicode DDEWrite() function.

For example, writing data from CitectSCADA to a Microsoft Office Application (using CitectSCADA as the DDE Client and the Office application as the DDE server), could be done using the following Cicode DDEWrite() function examples:

! Write PV1 to Excel
! Assumes the existence of Sheet1
DDEWrite("Excel", "Sheet1", "R1C1", PV1);

! Write PV1 to Word
! Assumes the existence of TestDDE.doc already loaded in Word
! containing the bookmark named TagPV1
DDEWrite("Word", "TestDDE", "TagPV1", PV1);
! MS Access does not support direct DDE writes.

This DDE function is one-way, so to update the tag value in the remote DDE server application, this function will need to be called every time the value of this CitectSCADA variable changes.

Writing directly to a DDE server assumes a prior knowledge of the DDE server. In the above example, the spreadsheet or document needs to exist and Excel or Word (as appropriate) needs to be running for the DDE communication to be successful.


See Also