Hi all.
I'm running a VBA code on my FTView which is actually working, but everytime I open the display that calls the VBA code, it throws the error:
"Object-variable or With block variable not set"
Since debugging the code was not highlighting the problem line, I had to isolate the code by parts until I find the problem line.
Below is the code and I highlighted the problem line:
Dim WithEvents INDICE_LISTA_AB As Tag
Dim WithEvents Ogroup As TagGroup
Private Sub Display_AnimationStart()
On Error GoTo Err
If Ogroup Is Nothing Then
Set Ogroup = Application.CreateTagGroup(Me.AreaName, 1000)
Ogroup.Add "{/CB/CC/DATA::[PLC]INDICE_LISTA_AB}"
End If
Ogroup.Active = True
Set INDICE_LISTA_AB = Ogroup.Item("{/CB/CC/DATA_CCO::[PLC]INDICE_LISTA_AB}")
INDICE_LISTA_AB.Value = 0
Exit Sub
Err:
LogDiagnosticsMessage Err.Description, ftDiagSeverityError
End Sub
Private Sub Input_Change()
On Error GoTo Err
If (Not INDICE_LISTA_AB.Value = 0) Then
Button.Enabled = True
Button.ForeColor = RGB(0, 0, 0)
Else
Button.Enabled = False
Button.ForeColor = RGB(192, 192, 192)
End If
Exit Sub
Err:
LogDiagnosticsMessage Err.Description, ftDiagSeverityError
End Sub
PLC tag is a DINT
How do I fix this error?
I'm running a VBA code on my FTView which is actually working, but everytime I open the display that calls the VBA code, it throws the error:
"Object-variable or With block variable not set"
Since debugging the code was not highlighting the problem line, I had to isolate the code by parts until I find the problem line.
Below is the code and I highlighted the problem line:
Dim WithEvents INDICE_LISTA_AB As Tag
Dim WithEvents Ogroup As TagGroup
Private Sub Display_AnimationStart()
On Error GoTo Err
If Ogroup Is Nothing Then
Set Ogroup = Application.CreateTagGroup(Me.AreaName, 1000)
Ogroup.Add "{/CB/CC/DATA::[PLC]INDICE_LISTA_AB}"
End If
Ogroup.Active = True
Set INDICE_LISTA_AB = Ogroup.Item("{/CB/CC/DATA_CCO::[PLC]INDICE_LISTA_AB}")
INDICE_LISTA_AB.Value = 0
Exit Sub
Err:
LogDiagnosticsMessage Err.Description, ftDiagSeverityError
End Sub
Private Sub Input_Change()
On Error GoTo Err
If (Not INDICE_LISTA_AB.Value = 0) Then
Button.Enabled = True
Button.ForeColor = RGB(0, 0, 0)
Else
Button.Enabled = False
Button.ForeColor = RGB(192, 192, 192)
End If
Exit Sub
Err:
LogDiagnosticsMessage Err.Description, ftDiagSeverityError
End Sub
PLC tag is a DINT
How do I fix this error?