The native format for Excel data is tab delimited text with a carriage return at the end of each row of data. When you perform a DDERequest function in Excel, the function returns a variable with the data type “Variant Array”. If the data that is requested with the DDERequest function is tab delimited with carriage returns at the end of each row of data and we assign this type of data to variant array, Excel will automatically parse the data and fill up the array with the data. If you use the FormulaArray function to assign a variant array variable to a range of cells, Excel will write the data to the specified range.
For example, if you have a device that generates data in the following format:
you can use the “pre-transfer translation table” in WinWedge to convert all commas to tabs so that the data would appear in the Wedge as follows:
Note: When WinWedge is in DDE Server mode, its default behavior is to strip out carriage returns by translating them to “Nulls” therefore we will also need to translate carriage returns back to carriage returns and not to nulls. Select “Pre Transfer Translation Table” from the DEFINE menu and select the comma character in the table and click the button marked “Translate”. When the ASCII chart appears, scroll the chart down to the TAB character (ASCII 9) and click the OK button to perform the translation.
Next select the carriage return character (ASCII 13) in the translation table and click the “Translate” button again. When the ASCII chart appears this time, select ASCII 13 and click the OK button. Click the OK button in the translation table to return to the main menu.
If you define the record structure in WinWedge as “Single Field Data Records” and thus pull the entire array into a single field in the Wedge and then pull the array into a variant array variable using Excel’s DDERequest function and finally use the FormulaArray function to assign the variant array to a range of cells, Excel will automatically parse the data and write it to a range of cells such that each cell will contain a single value from the array. Data elements separated by tabs will be written to cells across a row and each carriage return in the data causes Excel to place data following each carriage return in the next row down.
Complete setup example
The following example demonstrates how to set up the Wedge and Excel to pull in an entire comma delimited array (where each line of data in the array is carriage return terminated). By pulling in the entire array with a single DDERequest and letting Excel parse the data for us, you can pass huge amounts of data extremely quickly into a large range of cells.
Suppose you have a device that transmits a comma delimited array of data similar to the following where the entire array is transmitted once every ten seconds or in response to a prompt and you would like to input the data into a range of cells in Excel extremely quickly:
WinWedge DDE server settings
Remember to set WinWedge up in DDE Server Mode! See the DDE Server Mode Setup Guide.
DDE Application Name: Excel
DDE Topic: System
DDE Command: [RUN(“GetDataArray”)]
Excel instructions
Create or edit a general VBA code module and enter the following code in the module:
The example above sets up the Wedge to issue a DDE command to Excel forcing it to run the subroutine “ GetDataArray ()” after each complete array is received from the serial device. The “GetDataArray” subroutine performs a DDERequest to the Wedge that returns the contents of FIELD(1) to a variant array variable named “DataArray”. The entire array is then assigned to a range of cells in “Sheet1” using the FormulaArray function. The example above assumes that the open workbook contains a worksheet named Sheet1.
Note: This subroutine will also work with non-array type data (i.e. single data values). Single data values are actually equivalent to a single dimension array containing a single data element. Last modified on November 5, 2026