Skip to main content
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.

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(“GetSingleField”)]

Excel instructions

Create or edit a macro module in Excel and enter the following code in the module. (To create a new module click on Insert > Module from the Menus in the Visual Basic Editor Window.)
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