14.2.1.3     EXCEL macro to Write to tags in WebAccess via DDEPOKE

The EXCEL can write to WebAccess using the DDEPOKE command. In EXCEL 2000 and later, this requires the use of a macro, usually written in Visual Basic.  Below is an example of the code for a Visual Basic Macro in EXCEL to write the contents of Cell 'C2' into a tag named 'speed'.

Visual Basic macro for DDEPOKE

 

Sub PokeWebAccess()

     ' Dimension a variable.

      Dim Chan As Integer

 

      ' Initiate a channel to WebAccess DDE server bwddexe and its only topic.

      Chan = DDEInitiate("bwddexe", "topic")

          

      ' Poke the data in cell C2 into tag named speed in Webaccess.

      DDEPoke Chan, "speed", Sheets("Sheet1").Range("C2")

      

      ' Terminate the DDE channel.

      DDETerminate Chan

End Sub

The spreadsheet uses a button to run the macro.  This button can be created by drawing a rectangle around a cell and attaching the run macro function.  An example screen shot is:

Screenshot of EXCEL with DDEPOKE to write data to WebAccess

Figure 14.2.1.3 - EXCEL using DDEPOKE to write to tag in WebAccess