Cicode Programming Reference > Cicode Function Categories > Dynamic Data Exchange Functions Introduction > DDEhWriteLn

DDEhWriteLn

Writes a line of text to the DDE conversation. With this function, you can write any amount of text to the DDE conversation. Call this function once for each line of text. To terminate the block of text, call this function and pass an empty string.

Syntax

DDEhWriteLn(Handle, sTopic, sData)

Handle:

The integer handle that identifies the DDE conversation, returned from the DDEhInitiate function.

sTopic:

A unique name for the topic the data will be written to; for example, the spreadsheet cell position. The topic is only used when you complete the write by passing an empty string for data.

sData:

The line of data to write. To terminate the data and make CitectSCADA send the data, set the data to an empty string.

Return Value

0 (zero) if successful, otherwise an error is returned.

Related Functions

DDEhInitiate, DDEhExecute, DDEhRequest, DDEhTerminate, DDEhGetLastError, DDEhPoke, DDEhReadLn, DDEhWriteLn, DDEhSetMode

Example

!	Write to Excel spreadsheet
! write the numbers 1..8 into 8 unique cells in Excel.
FUNCTION WriteExcelData(STRING sData);
INT hChannel;
hChannel = DDEhInitiate("EXCEL", "DATA.XLS");
IF hChannel > -1 THEN
// set to CSV mode so EXCEL will put each value in a cell
DDEhSetMode(hChannel, 2);
DDEhWriteLn(hChannel, "", "1,2,3,4");
DDEhWriteLn(hChannel, "R1C1:R2C4", "5,6,7,8");
DDEhWriteLn(hChannel,"R1C1:R2C4","");
DDEhTerminate(hChannel);
hChannel = -1;
END;
END

See Also

DDE Functions