DDE Topic won't terminate from VBA

HuntWhenever

Member
Join Date
Dec 2011
Location
SW Ohio
Posts
1
I have recently installed RSLinx Single-Node and I'm writing an Excel macro to read some recipe data from some PLCs. The macro is pretty straight forward with one exception: I can't seem to get the DDE topic to terminate so I can read a different PLC (RSLinx Single Node only allows one topic at a time).
Here's my macro in a nutshell...

Private Function OpenRSLinx(Topic As String) As Long
On Error Resume Next
OpenRSLinx = DDEInitiate("RSLINX", Topic)
If Err.Number <> 0 Then
MsgBox "Error Connecting to Topic", vbExclamation
OpenRSLinx = 0
End If
End Function

Sub ReadClick()
Dim UsedTopic As String
UsedTopic = Cells(1, 1)
rslinx = OpenRSLinx(UsedTopic)
'Reading code goes here
DDETerminate rslinx
End Sub


This works for one PLC. When I change to a different PLC (different topic), I get an error because RSLinx Single Node cannot run more than one topic. When I look at the Active DDE/OPC Topic List in RSLinx, the first topic I ran is listed as Active. Also, when I bring up the DDE/OPC Topic Configuration menu in RSLinx, in the Topic List on the left hand side shows the topic I just ran with a lock symbol beside it. The only way I can run another topic is to shut down RSLinx, then run my macro again with the different topic name.

Am I missing something here? All the research I've done indicates that DDETerminate is all that should be needed.

Additional info:
- Windows 10 Pro
- Office Excel 365 version 2005
- RSLinx Classic Single-Node Revision 4.12.00 CPR 9 SR 11.0
 

Similar Topics

Hi Guys, This is my first post so not sure what response I will get. I regularly use Excel to retrieve data from PLC's at work as it is quicker...
Replies
6
Views
2,598
I have the following DDE Topic in Excel from a ControlLogix processor: =RSLINX|'SW123'!'CCip_Rcp[0].FiRns.Vol_Sp,L1,C1' It was created using a...
Replies
0
Views
2,810
hi, Can you guys help me out in understanding the function of DDE/OPC , topic config in RSlinx software.
Replies
3
Views
2,855
Hello guys, I have been trying since yesterday, I can't activate DDE TOPIC lists on RSLinx Classic Single Node. I've tried all configuration...
Replies
3
Views
2,853
I've already setup DDE/OPC topic at RSLINX OEM version. I even copied the link to excel. Now I saved excel file into our company's network drive...
Replies
2
Views
3,344
Back
Top Bottom