DDEPoke to Intouch from Excel

ettikudiappan

Member
Join Date
Apr 2002
Location
Singapore
Posts
131
Hi

I am having an InTouch application and want to use a DDEPoke from Excel to modify a "Memory Message" tag.
I am successful in reading this tag from excel using DDERequest instruction. But when I use DDEPoke to write to the tag, I am not able to change the tag. The name of the tag I am writing to is Product_Code . I have tried writing to this tag using
DDEPoke channel, "Product_Code", "MRU" and also using
DDEPoke channel, "Product_Code.Value", "MRU"

Both ways, I am unsuccessful. What is it that I am doing wrongly, or does InTouch not allow DDEPokes to Memory Messages?
 
Hi ettikudiappan,

Its been a while since I did anything like this, but HERE is a link to Microsoft's MSDN library and, specifically the DDEPoke command.

From what I can tell with the little bit of research I have done:

1) you may need to establish communcation with the DDEInitiate command if you have not already.

2) where you have "channel" written as an argument in your code, you probably need to have something like "chan1" instead. This argument is defined by the value returned from the DDEInitiate instruction.

Example:
chan = DDEInitiate("Excel", "System")
DDEPoke(chan, "R1C1", Str$100)

If I am not mistaken, this command will poke a value of 100 into cell R1C1.

Obviously your need is to poke FROM Excel INTO InTouch, so you will definitely have to modify this logic the other way.

Also make sure that the value you are poking is in the correct format. According to the literature I have, DDEPoke only transfers strings so you may have to do some conversion at the receiving end once the poke is complete.

Hope this helps a little.

Steve
 
Thanks for all your replies. I have clearly stated in my message that the type of tag that I am trying to POKE is a Memory Message. Which is a string basically. I have tried using Channel_Num, instead of Channel. No use. I have also clearly mentioned that I can do a DDERequest, which means that I have been successful in initiating the DDE conversation. The DDERequest was made on the same tag that I am trying to write. The only thing that doesn't work is DDEPOke.

I am not trying to write a value from a cell to the tag. I am setting the string (data) directly inside the VBA code to the value "MRU".

I am not sure how useful it is, but the InTouch application name is BoilerBMU.
 
If you would, how about posting your exact code for your DDERequest. It just might help the rest of us a little.

Just as a note, I have used the DDEPoke command from Excel to InTouch before (4 or 5 years ago) without any problem. So I know it does work.

Just a thought: Is there any chance that your InTouch application is imediately writing back over the value you sent via the DDEPoke command? A really simple test would be to create an otherwise unused tag in InTouch and read/write to it.

Steve
 
Here is the code

Dim str As String
chan_num = DDEInitiate("view", "tagname")
result = DDERequest(channel, "lot_num")
str = result(1)
DDEPoke channel, "lot_num", "ABC123"

In the above code, I am able to read the value of the tag "lot_num" using DDERequest. But when writing to it, nothing happens, unless I change the last line to
DDEPoke channel, "lot_num", sheet1.cells(1,1)
If I place the value to be poked in cell R1C1, the above command poke the correct value to the tagname. The problem occurs only when I try to poke a direct string value to the tag instead of a reference to a cell address.
 
You say you can successfully poke a value of 123 from cell R1C1 to your tag.

Have you tried placing the value ABC123 in cell R1C1?
If so, what is the result?

Assuming that does not work either, is it possible that your InTouch tag is numeric only and does not support alpha-numeric values?

If you can poke a "numeric" value but not an "alpha-numeric" value, it seems that the problem has to be with the InTouch Tag.

Steve
 

Similar Topics

I have read several posts related to this Topic and gathered information from each but have still had no success. Attached is where I'm stuck. I...
Replies
3
Views
2,732
Hello all. First post here. I'm using Excel to handle all of my tag data and such. I'm wondering if there is a way to write to tag descriptions...
Replies
0
Views
1,497
I used DDE to message down data to a bunch of PLCs, most of the time it is all numeric and this works fine. However with this latest PLC I have...
Replies
5
Views
4,617
Hello, I have write the follow VBA-code in Excel: sub test() dim woord as integer dim channelnum as long woord=150...
Replies
9
Views
5,906
Hi all. Customer wants analog faceplates really bad, even if we explained that it doesn't make much sense in his process. What he wants to see...
Replies
5
Views
110
Back
Top Bottom