Excel VBA: RsLinx DDE example

'Initialize DDE
channelNumber = Application.DDEInitiate("RSLinx", "SomeTopicName")

'Read from PLC5
readValue = DDERequest(channelNumber, "N20:1")
'Read from ControlLogix
readValue = DDERequest(channelNumber, "ControlLogixTag[1]")

'Write to PLC
Set rangeToPoke = Worksheet("Sheet1").Range("A1")

'Write to PLC5
Application.DDEPoke channelNumber, "N20:2", rangeToPoke
'Write to ControlLogix
Application.DDEPoke channelNumber, "ControlLogixTag[1]", rangeToPoke

'End DDE
Application.DDETerminate channelNumber