DDEEXPORT procedure
Sends data or commands to a Dynamic Data Exchange server, PC Windows only (D.B. Baird).
Options
Parameter
Description
The data to be written via DDE is specified by the DDE triplet: server, topic and item. For convenience this has been broken down to the components OUTFILE, SHEETNAME, COLUMN and ROW for the two common spreadsheets Excel and Quattro Pro for Windows. For Excel/QPW also only the first cell need be provided and GenStat will automatically work out the correct item range given the size of the DATA structures passed to DDEEXPORT.
When a command is being sent to a DDE server (METHOD=command), the DATA must be a text, and only the SERVER and TOPIC options need to be set.
The LABELLING option allows you to only send the required aspects of the data to the DDE server.
The TOPIC for Excel has the format '[<FileName>]<SheetName>' e.g. '[D:/Work/Data.XLS]Data Summary', and the ITEM has the numerical format R<n1>C<n2>:R<n3>C<n4> e.g. 'R2C3:R25C5' or the format '<Column letter><rowno>:<Column letter><rowno>' e.g. 'C2:E25'.
The TOPIC for QPW has the format 'FileName' e.g. 'D:/Work/Data.WB3', and the ITEM has the format of 'Sheet:<Column letter><rowno>..<Column letter><rowno>' e.g. 'B:C2..E25'.
The use of DDEEXPORT is illustrated in the following examples. To write three variates to a QPW file in the first sheet in cells B2..D8:
DDEEXPORT [SERVER=QPW; TOPIC='C:\\WORKBOOK.QPW';\
ITEM='A:B2..D8'] X,Y,Z
To write a matrix to Excel in the cells starting at D5:
DDEXPORT \
[topic='[D:\\\\DATA\\\\RESULTS.XLS]Sheet2';item='D5'] VC
To send a set of DDE commands to Excel:
TEXT CMDS; !T('[OPEN(""C:\\\\TRIAL\\\\DATA.XLS"")]', \
'[WORKBOOK.INSERT(1)]', \
'[SELECT(""A4..D8"")]')
DDEXPORT [METHOD=command] CMDS
Excel DDE commands are a subset of the Excel 4 macro language. The format of the commands are [Function(arg1,arg1,...)]. text strings in the arguments are quoted with double quotes (e.g. "A1"). The following is a subset of Excel commands which may be useful:
Complete details are available in the Windows help file Macrofun.hlp available on the Microsoft Internet site.
(Note: DDEEXPORT replaces the procedure %DDE from earlier editions of GenStat.)
Options: SERVER, TOPIC, ITEM, OUTFILE, SHEETNAME, COLUMN, ROW, LABELLING, METHOD.
Parameter: DATA.
Action with
RESTRICT
Restrictions on the structures are ignored and all data will be sent to the DDE server. However, if the restrictions on the structures are not consistent, a fault will occur.