Hi all
I am trying to write an array in PLC from my excel data base
below is code
Sub Update()
Dim Test_array_Src() As String
RSlinx = OPENRSlinx()
For x = 0 To 500
realdata = DDERequest(RSlinx, ("Source_array.Test_array_SRC_DINT[" & x & "],L1,C1"))
If TypeName(realdata) = "Error" Then
If MsgBox("Error reading tag Source_array.Test_array_SRC_DINT[" & x & "]. " & "Continue with write?", vbYesNo + vbExclamation, "error") = vbNo Then Exit For
Else
DDEPoke RSlinx, "Source_array.Test_array_SRC_DINT[" & x & "]", Cells(x + 1, 2)
End If
Next x
DDETerminate RSlinx
End Sub
Private Function OPENRSlinx()
On Error Resume Next
OPENRSlinx = DDEInitiate("RSLINX", "My_topic")
If Err.Number <> 0 Then
MsgBox "Error Connecting to topic", vbExclamation, "Error"
OPENRSlinx = 0
End If
End Function
I am getting error in finding tag , it gives error code "Realdata=Error 2023"
Please help
I am trying to write an array in PLC from my excel data base
below is code
Sub Update()
Dim Test_array_Src() As String
RSlinx = OPENRSlinx()
For x = 0 To 500
realdata = DDERequest(RSlinx, ("Source_array.Test_array_SRC_DINT[" & x & "],L1,C1"))
If TypeName(realdata) = "Error" Then
If MsgBox("Error reading tag Source_array.Test_array_SRC_DINT[" & x & "]. " & "Continue with write?", vbYesNo + vbExclamation, "error") = vbNo Then Exit For
Else
DDEPoke RSlinx, "Source_array.Test_array_SRC_DINT[" & x & "]", Cells(x + 1, 2)
End If
Next x
DDETerminate RSlinx
End Sub
Private Function OPENRSlinx()
On Error Resume Next
OPENRSlinx = DDEInitiate("RSLINX", "My_topic")
If Err.Number <> 0 Then
MsgBox "Error Connecting to topic", vbExclamation, "Error"
OPENRSlinx = 0
End If
End Function
I am getting error in finding tag , it gives error code "Realdata=Error 2023"
Please help
Last edited: