error 2023 when connecting excel to plc

NoLegalMoves

Member
Join Date
Jul 2012
Location
Utah
Posts
6
I can't figure out what is not working...

Private Function OpenRSLinx()
On Error Resume Next

'Open the connection to RSLinx
OpenRSLinx = DDEInitiate("RSLINX", "PLC15")

'Check if the connection was made
If Err.Number <> 0 Then
MsgBox "Error Connecting to topic", vbAbortRetryIgnoreExclamation, "Error"
' OpenRSLinx = 0
End If

End Function

Sub Button1_Click()

Dim i As Integer


'write to PLC15
rslinx = OpenRSLinx() 'Open connection to RSlinx

'Loop through the cells and write values to the CLX array tags
For i = 0 To 9

'Get the value from the DDE link
realdata = DDERequest(rslinx, "CLN_823L31_3101_SPT[" & i & "],L1,C1")
'If there is an error, display a message box
If TypeName(realdata) = "Error" Then
If MsgBox("Error reading tag CLN_823L31_3101_SPT[" & i & "]. " & _
"Continue with read?", vbYesNo + vbExclamation, _
"Error") = vbNo Then Exit For
Else
'No error, place data in CLX
Cells(i, 2) = realdata

End If

Next i

'Terminate the DDE connection
DDETerminate rslinx

End Sub
 
I can't figure out what is not working...

Private Function OpenRSLinx()
On Error Resume Next

'Open the connection to RSLinx
OpenRSLinx = DDEInitiate("RSLINX", "PLC15")

'Check if the connection was made
If Err.Number <> 0 Then
MsgBox "Error Connecting to topic", vbAbortRetryIgnoreExclamation, "Error"
' OpenRSLinx = 0
End If

End Function

Sub Button1_Click()

Dim i As Integer


'write to PLC15
rslinx = OpenRSLinx() 'Open connection to RSlinx

'Loop through the cells and write values to the CLX array tags
For i = 0 To 9

'Get the value from the DDE link
realdata = DDERequest(rslinx, "CLN_823L31_3101_SPT[" & i & "],L1,C1")
'If there is an error, display a message box
If TypeName(realdata) = "Error" Then
If MsgBox("Error reading tag CLN_823L31_3101_SPT[" & i & "]. " & _
"Continue with read?", vbYesNo + vbExclamation, _
"Error") = vbNo Then Exit For
Else
'No error, place data in CLX
Cells(i, 2) = realdata

End If

Next i

'Terminate the DDE connection
DDETerminate rslinx

End Sub
Did you ever find a solution to your Error 2023? I am having the same issue.
 
sorry i dont think so.. i stopped working on this a while back

NoLegalMoves,

Looking at you code there are some discrepancies, please see below.

Here a list of items that I would check and/or modify:

1) Check that you have a valid DDE Topic in RSLinx named "PLC15"
2) In [Private Function OpenRSLinx()] - Replace "vbAbortRetryIgnoreExclamation" with "vbExclamation"
3) Comment out [Dim i As Integer] - Don't Need This
4) Uncomment [OpenRSLinx = 0]
5) Verify that "CLN_823L31_3101_SPT" is a REAL and the number of elements in your array matches, in your case the For i value or 10.
6) Cells(i, 2) = realdata is reading from the PLC to Excel not Writing to PLC. To write the "values" back into the PLC, you would use something like this:
DDEPoke rslinx, "CLN_823L31_3101_SPT[" & i & "]", Cells(i, 2)
7) If you have more than "1" worksheet, you MUST specify the worksheet that you want to read to or write from.

Hope this helps.

K
 
Last edited:

Similar Topics

I am kind of new to GE products, but we have several in my area. I made a minor logic change and it verified good, but when I tried to download I...
Replies
5
Views
43
Hi, I'm currently having issued with a PowerFlex 252. It was working fine last week, and suddenly decided to stop working. When I go into...
Replies
2
Views
108
Hi there, I'm new to plc programming and was wondering why I get this error code when I run my simulation for these temperature sensors? What I'm...
Replies
2
Views
87
Hi Everyone. Not posted on here for a long time, but I am hoping someone can help me. I am doing a differential pressure calculation in a L27ERM...
Replies
16
Views
394
Hello Everyone, I have a issue with communication between two different PLCs. So here is the facts, The Master PLC is Guard Logix 5069 with IP...
Replies
4
Views
123
Back
Top Bottom