DDE Links from Excel to InTouch


Thread Starter

David Raeburn

I have data data being read from another piece of software via DDE and it is displayed in a real time format as well as being stored for historical analysis.

I can't seem to make the Excel macro poke the data directly into a tag. Is this the best way to carry out the task? If so, does anyone have any similar examples they could share.


Stephane Cousin

Before trying the exemple below, check that the "DDEShare" service of windows is correctly configured as it's written in the intouch manual.

Here are some examples of a request and a poke macro:

the tagname in tne DB of intouch is "Temperature1"
and is a memory tag.

{This opens a DDE channel to View}
{Puts Temperature1 value in "Data"}
{This terminates the DDE channel}
=RETURN() {End of Macro}

{This opens a DDE channel to View}
=POKE(Channel,"Temperature1",Sheet1.xls|R1C1) {Pokes value in r1c1 of sheet1.xls into Temperature1}
=RETURN() {End of Macro}

To read only data from intouch, it's explain in the intouch manual. for more, in the Intouck package, there a blue CD called "Compprehensive support knowledge base CD".

Gary Majkowski

"If the only tool you have is a hammer, every problem becomes a nail."
I had to move data to and fro via DDE. It gets really easy if you use VB6. Both the label and text box have properties which define DDE links. (not available in the VBA version in EXCEL) You get a lot more latitude about what events trigger the poke. (time, data change)
You can define any form in a VB application to be a DDE source with the linkmode and linktopic properties. Very straightforward and simple.
One of the DDE connections is to/from an Intouch I/O server, another to an Excel spreadsheet. The whole system's been very reliable.


Mike Boicescu

Please clarify the following:
- Is the "other piece of software" a DDE Server?
(1) If yes, then poke your Excel data DIRECTLY into the DDE Server, without using InTouch tags (the shorter the way, the safer). The Poke's structure is similar to the one in Stephen Cousin response, but check the DDE Server's documentation or help for details.
- Is this value meant for a device connected to your PC through a physical link (e.g. serial,ethernet)?
(2) Poking directly from your Excel/Word application into a DDE link is a tricky proposition, due to the multitasking nature of Windows, and the piped message queue-ing. If possible, do a read-after-write (using Peek) in your macro, and repeat the write if the result is different. If this is not possible, try to repeat the Poke several times.
(3) Some devices won't acknowledge the value written into them for a certain delay. This is typical for devices that write the data into Flash Eprom (usually 500 msec). You will then need to modify your macro to perform a read-after-write only after this delay. Try to avoid performing any DDE operations involving that device during this "black-out" delay.
Good Luck, Mike