Principle
The following example illustrates the principle of the procedure for adding dynamics to an
object property:
Sub CreateDynamicOnProperty()
'VBA57
Dim objVariableTrigger As HMIVariableTrigger
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle1", "HMICircle")
'
'Create dynamic with type "direct Variableconnection" at the
'property "Radius":
Set objVariableTrigger =
objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeVariableDirect, "'NewDynamic1'")
'
'To complete dynamic, e.g. define cycle:
With objVariableTrigger
.CycleType = hmiVariableCycleType_2s
End With
End Sub
Note
Note that a variable is not created simply by specifying the variable name. Use the variable
selection dialog to create the variable.
Tag connection
Use the VariableTrigger object to add a dynamic to a property with a direct or indirect variable
connection. The dynamic property then responds in runtime to a change in value to the
specified variable. To allow this, in VBA you need to specify the variable name (VarName
property) and the cycle (CycleTime property).
Dynamic dialog
Use the DynamicDialog object to add a dynamic to a property with the aid of the Dynamic
dialog. The dynamic property responds in runtime to a variable's value ranges. The following
objects are available for specifying the value range:
● AnalogResultInfos-Objekt: Use this object to assign a fixed value to value ranges of a
variable
or a script. The fixed value is assigned to the dynamic property when the variable
value or return value of the script is within the specified value range.
● BinaryResultInfo Object: Use this object to assign a fixed value to binary value ranges (zero
and non-zero) of a variable or a script. The fixed value is assigned to the dynamic property
when the variable value or return value of the script returns one of the two values.
● VariableStateValue Object Use this object to assign a fixed value to the state (e.g. "Upper
limit exceeded") of a specified variable. The fixed value is then allocated to the dynamic
property when the state occurs.
VBA for Automated Configuration
4.3 VBA in the Graphics Designer
MDM - WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 11/2008,
1633