Specifications

RSLinx – Training Guide 67
Additional Macro Examples:
Using procedures similar to those on the previous pages, the following Visual Basic
Code can be added to additional command buttons to do a read from PLC, a block read,
and a block write.
Read a word (reads T4:0.acc and places in cell C7 on DDE_Sheet):
RSIchan = DDEInitiate("RSLinx", "testsol")
data = DDERequest(RSIchan, "T4:0.acc")
Range("DDE_Sheet!C7").Formula = data
DDETerminate (RSIchan)
Write a block of five words (from cells A7-A11 on DDE_Sheet):
RSIchan = DDEInitiate("RSLinx", "testsol")
DDEPoke RSIchan, "N7:30,L5", Range("DDE_Sheet!A7:A11")
DDETerminate (RSIchan)
Read a block of five words (and displays in cells B7-B11 on DDE_Sheet):
RSIchan = DDEInitiate("RSLinx", "testsol")
data = DDERequest(RSIchan, "N7:30,L5,C1")
Range("DDE_Sheet!B7:B11").Formula = data
DDETerminate (RSIchan)