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

Hi guys, Im trying to set the real time clock in my Mitsubishi FX1N, but it shows this error ES: 01800001 I have good communication with...
Replies
3
Views
129
Hi, I am facing an error inside Omron Network Configurator. I have 2 PLC communicate each other using ethernet cable, send signal using Network...
Replies
2
Views
92
hi... i have an issue in s7 300 plc, while we run the machine(in idle there is no fault) , plc cpu goes in SF mode, after restart the power cycle...
Replies
2
Views
102
I have a Sinumerik 828D control panel and its for a CNC machine, the problem is that it gives an error state 700027 tool turret state :S4...
Replies
0
Views
95
I am having a problem communicating my PLC with Drive via Modbus connection. I start by opening the port and there is no problem, but then when I...
Replies
6
Views
185
Back
Top Bottom