Pieter Bruggeman
Member
I have VBA code on a FactorTalk View SE v11 project that reads various PLC tags in a FOR loop. All is good if the PLC tag exist.
But for a non-existing PLC tag, the “Tag Read” times-out. Via the “Tag Quality” the error is catched and moved on the next tag in the array.
The time-out time is long, ~20s, and therefore I want to stop reading this tag and directly go to the next tag in the array.
The “Tag Quality” updates only after the time-out, so does the Tag Property “LastErrorNumber”, “LastErrorString”. The “Err.Number” stays 0.
Yet in the FactoryTalk Diagnostic, the message “Item .. is unresolved in the processor …” is logged immediately.
How can I catch in VBA code this error and directly go to the next tag in the FOR loop ?
Thanks in advance.
VBA CODE
But for a non-existing PLC tag, the “Tag Read” times-out. Via the “Tag Quality” the error is catched and moved on the next tag in the array.
The time-out time is long, ~20s, and therefore I want to stop reading this tag and directly go to the next tag in the array.
The “Tag Quality” updates only after the time-out, so does the Tag Property “LastErrorNumber”, “LastErrorString”. The “Err.Number” stays 0.
Yet in the FactoryTalk Diagnostic, the message “Item .. is unresolved in the processor …” is logged immediately.
How can I catch in VBA code this error and directly go to the next tag in the FOR loop ?
Thanks in advance.
VBA CODE
Code:
Private PLCTag() As Tag
For i = 1 To lngNumberOfParameters
On Error Resume Next
PLCTag(i).GetTagData Value, TimeStamp, Quality, SubStatus, Limit, True
Select Case Quality
Case 0:
GoTo Skip
Case Else
…
End Select
Skip:
Next i