Quantcast
Viewing all articles
Browse latest Browse all 50163

DDEPoke a value through RSLinx OEM to an address in my PLC using VBA

I am running the VBA code:

RSIchan = DDEInitiate("RSLinx", "Topic_Name")
DDEPoke RSIchan, "Program:MainProgram.REC_Unlatch", Range("K3")
DDETerminate (RSIchan)

This code is taking the value in cell K3 (value of 1) and sending it to a relay contact in my PLC using the address "REC_Unlatch". It works fine. I would like to just send a 1 to my PLC, without having to reference a cell in Excel. Can this be done, and if so, how would I format the instruction?

Thanks in advance!

Viewing all articles
Browse latest Browse all 50163

Trending Articles