Excel DDE macro examples
Collecting a single field of data into Excel
Collect a reading from your device into Excel with WinWedge using its more advanced DDE mode.
This basic example demonstrates using DDE to automate data collection in Excel. When WinWedge receives a record while in DDE Server Mode, it will send a command to the application/topic specified in the WinWedge settings (Mode > DDE Server Mode). Usually this command is running a subroutine. For instance, the command [RUN(“GetSingleField”)] sent to an application Excel and a topic of System will run the subroutine in this Example. Make sure that the COM Port being referenced is the same COM Port your device is on! If your device has multiple fields of data, please review this example.
The example above sets up WinWedge to issue a DDE command consisting of the Excel “RUN” command forcing Excel to run the subroutine “GetSingleField()” after each data record is received from your serial device. The “GetSingleField” subroutine performs a DDERequest to WinWedge that returns the contents of FIELD(1) to a variable named “vDat”. The data is then converted to a string variable, sDat, and assigned to a cell in the first worksheet. If you want to send the data to a specific Excel sheet (not the first one), replace Sheets(1) with Sheets(“MySheetName”) in any of these code examples – where MySheetName is the actual name of your sheet.
Last modified on November 3, 2026