Value

<< Click to Display Table of Contents >>

 

Value

Variant This property is updated whenever performing a new valid reading of a value from a device using its configuration, but the data type of this variable (integer, floating point, or text) depends on the OPC Driver to which it is linked and on its configuration. This property is only updated this way if the AllowRead property is set to True and there is no communication errors (in this case only the Quality and TimeStamp properties are updated), but according to a scan time defined on the OPC Group to which the OPC Tag belongs. Another way of using this property is writing values to the device. Just set a new value to the Value property or any of the Bit00 to Bit31 bits, as long as the AllowWrite property is set to True. This property is also the standard property of an OPC Tag object. Thus, a reference by value to an OPC Tag object does not need to explicit use the Value property to access its value. Default value of this property is empty. Example:

Sub Button1_Click()
  ' Accesses a Tag and shows its current value
  ' tag1 is an OPCTag-type object
  Set obj = Application._
    GetObject("CommDriver1.tag1")
  MsgBox "Tag1's current value: " & obj.Value
  ' Without showing the Value property,
   which is the default one
  MsgBox "Tag1's current value: " & obj
End Sub

Was this page useful?