Questions? Search our site or call us at 1-800-722-6004

Quattro Pro: Collecting Data To a Column In a Quattro Spreadsheet

WinWedge DDE Server Settings

Remember to set WinWedge up in DDE Server Mode! Click here.

DDE Application Name: QPW
DDE Command: {Get_Wedge_Data}

Quattro Pro

Quattro Pro does not have a "Get_Wedge_Data" DDE command so the first step is to create one. When you create and name a macro in a Quattro Pro notebook, the name of the macro automatically becomes a valid Quattro Pro DDE command for as long as the notebook is open.

Enter the following lines into cells in a Quattro Pro notebook and name each cell or group of cells using the block names indicated below.

Block Name Block Contents

row 1
column A
cell_number A1
dde_channel 0
dde_command [beep]
result 0

get_wedge _data {ONERROR _error_handler}

{REQUEST dde_channel,"FIELD(1)",@@("cell_number")}
{LET row,row+1}
{LET cell_number,+column&@string(row,0)}
{EXECUTE dde_channel,+dde_command,result}

_error_handler {INITIATE "WinWedge","COM1",dde_channel}

This example sets up WinWedge to issue a DDE command to Quattro Pro consisting of the name of a macro (get_wedge_data) after each data record is received from your serial device. The macro performs a DDE Request to WinWedge that returns the contents of FIELD(1) to a spreadsheet cell pointed to by the variables named "row" and "column". (i.e. row 1, column A)

The blocks with the names "row", "column", "cell_number", "dde_channel", "dde_command" and "result" are simply variables that are used by the "get_wedge_data" macro. The "get_wedge_data" macro first sets up an error handler pointing to the macro named "_error_handler". The following line then attempts to request the data for "Field(1)" from WinWedge and store the data in a cell whose address is pointed to by the variable "cell_number". The first time the macro is invoked the "request" command will fail because a DDE channel has not yet been opened. The purpose of the "_error_handler" macro is to simply initiate the DDE channel when the first call to "get_wedge_data" fails. After the "request" macro command, the variable "row" is incremented and the variable "cell_number" is updated using the new row number so that it points to the cell directly below the one where the last data reading from WinWedge was stored. Thus, each time a new data record is received by WinWedge, the contents of "Field(1)" will be retrieved and stacked up in a column. The final macro line in the "get_wedge_data" macro uses Quattro Pro’s "Execute" command to issue a "Beep" command to WinWedge. This line has been included as an example of how to send DDE commands to WinWedge from Quattro Pro.


Categories: Macro / Code Sample, Other Applications, WinWedge

Last Updated: 2011.07.12

Need more help?

Don't hesitate to call or email us with your questions

Our office is open 9AM - 5PM Monday Through Friday (E.S.T.)

Technical Support: 215-496-0202

Toll-Free: 1 (800) 722-6004
Skype: taltech1 (Voice only)