Hello!
I am using zenon Supervisor 7.00 SP0 Build0.
I am create variable for driver "Modbus RTU and Open Modbus TCP" with name "Test:".
I want set AVALUE (ALT_VAL) state for variable "Test" using VBA.
VBA Code:
'For set AVALUE used (NOT WORK):
Public Sub LeftClickDown_Set_ALT_VAL(obElem As Element)
thisProject.Variables.Item("Test").SetValueWithStatus 11, 138674176, Now, 0
'thisProject.Variables.Item("Test").SetValueWithStatusEx 11, 138674176, 0, Now, 0
End Sub
'For clear AVALUE used (NOT WORK):
Public Sub LeftClickDown_Clear_ALT_VAL(obElem As Element)
thisProject.Variables.Item("Test").SetValueWithStatus 11, 4456448, Now, 0
'thisProject.Variables.Item("Test").SetValueWithStatusEx 11, 4456448, 0, Now, 0
End Sub
'For get status variable used (WORK):
Public Sub LeftClickDown_Status_ALT_VAL(obElem As Element)
thisProject.Variables.Item("StatusTest").Value = thisProject.Variables.Item("Test").StatusString
thisProject.Variables.Item("StatusTestValue").Value = thisProject.Variables.Item("Test").StatusValue
End Sub
If i used VBA the state value not changed, if i used button "Selected variable: switch to alternate value" on the screen "Variable diagnosis" state changed.
Thanks!
This is a migrated post! Originally posted on 28.07.2012 by user boykooo. Please be aware that information can be outdated.