OnlineVariables

 

Remarks Properties Methods Samples

ED
not used
RT
avaliable

Remarks:Top

This collection contains the single objects OnlineVariable. An online variable is an object, in which control system variables are linked, which on being initialized or changed execute a VBA event. In this VBA event user defined actions can be defined.

The usage of online variables is recommended for the reading of variable values, as all variables linked to the online variable can be ordered with one action. This enhances the performance.

An online variable can be compared to a container or

Properties:Top

Count Parent  

Methods:Top

CreateOnlineVariables DeleteOnlineVariables Item

Samples:Top

Dim WithEvents zOLV As OnlineVariable
Const strOLV As String = "MyOnlineVariableContainer"

'initialize event on runtime startup
Private Sub Project_Active()
	'get object if already exists
	Set zOLV = thisProject.OnlineVariables.Item(strOLV)
	If zOLV Is Nothing Then
		'if not exitst, create a new OnlineVariable container
		Set zOLV = thisProject.OnlineVariables.CreateOnlineVariables(strOLV)
		'add variables to the container
		zOLV.Add "Variable1"
		zOLV.Add "Variable2"
		zOLV.Add "Variable3"
	End If
	'activate 'VariableChange' event
	zOLV.Define
End Sub

'event is fired when a variable value changes
Private Sub zOLV_VariableChange(ByVal obVar As IVariable)
Dim vValue As Variant
	vValue = obVar.Value
	'ignore error values (i.e. on startup)
	If IsError(vValue) Then Exit Sub
	Debug.Print obVar.Name & " = " & vValue
End Sub

'release objects on closing the runtime
Private Sub Project_Inactive()
	'deactivate 'VariableChange' event
	If Not zOLV Is Nothing Then zOLV.Undefine
	Set zOLV = Nothing
End Sub