Engineering Tip

The VBA scripting for Client Builder is a very powerful tool.   One of the useful scripting events that you can use is the Mimic Open event.   This can be used to initialize the mimic to a particular "startup" state or re-direct animations to a particular set of IO points (see Building one mimic for multiple sets of IO points ).

The mimic events require that the mimic has the property, "Enable Events" = True.   The property can be changed in the Display->Properties List and/or the Scripting Editor under the mimic properties.   But you may not get it to stay = True.

When you create an event like Mimic Open, it will automatically set Enable Events = True.  Save the drawing and try it again, and it may be Enable Events = False.   This is because the Mimic may be inheriting settings from the template in use.

To resolve this, open the template that your mimic uses.   Create a "stub event" for the template so that the Enable Events = True for the template:

Private Sub Mimic_Open()

'stub event to force EnableEvents = True

End Sub

This will cause the Enable Events for the template to remain = True.   Then you can go back to the mimic and add the Mimic Open event which will cause the Enable Events = True to stay set.  You must get the template Enable Events = True before setup of any Mimic events such as  Open, Before Close, etc.