DDEPoke does not working

mulderm

Member
Join Date
Jun 2003
Location
Netherlands
Posts
298
Hello,

I have write the follow VBA-code in Excel:

sub test()
dim woord as integer
dim channelnum as long
woord=150
channelnum=DDEInitiate("rslinx", "testsol")
DDEPoke channelnum, "N7:0", woord
DDETerminate (channelnum)
end sub

When I run this code nothings happend in N7:0.
Why does this not working?
I have created a topic and that is working.

mulderm
 
I've had trouble poking the contents of excel variables into a PLC. It usually works fine with a literal. Try changing:

DDEPoke channelnum, "N7:0", woord

to

DDEPoke channelnum, "N7:0", 150

and see if it will work. I will look around for some old posts that dealt with this issue. I can't remember the solution, but should be able to search for it.
Paul C.
 
I think it will not work until you you change:
DDEPoke channelnum, "N7:0", woord
To somthing like:
DDEPoke channelnum, "N7:0", Cells(1,1)
 
Sorry, I misspoke in my earlier post. I never have gotten a lieteral or variable to work with DDEPoke, only cell references. You may also need to insert a DDEInitiate statement:

DDEInitiate ("RSLinx", "topicname")

Then try DDEpoke-ing with a cell reference like:

DDEPoke channelnum, "N7:0", [A1]

If that doesn't work, there's something wrong with the topic config, or comms. I can get cell references to work like the one above, but have never been able to use a variable name or literal in a DDEPoke. Please let us know if you succeed.
 
It only works with cell references in Excel.
In Access it will works good with a variable name.

The right code:

sub test()

dim channelnum as long
Worksheets("DDE").Range("A1").value=150
channelnum=DDEInitiate("rslinx", "testsol")
DDEPoke channelnum, "N7:0", Worksheets("DDE").Range("A1")
DDETerminate (channelnum)

end sub

Thanks for the helping guys.

mulderm
 

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,616
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...
Replies
6
Views
7,448
Back
Top Bottom