Create and test an event handler
An event handler is a subroutine that runs in response to an event. Events can be raised from the display itself or from objects in the display. You can create an event handler for a
FactoryTalk View SE
display and test the event from the VBA IDE.To create and test an event handler:
- In theMicrosoftVBA IDE, in the code window, type the code for the event handler between theSubandEnd Substatements, .
- SelectFile>Save, to save display with the subroutine.
- To test the event handled, selectRun>Run Sub/User Form. When the event is fired, the code will run.
- In theGraphicseditor open the display for which you are going to write display code.
Remarks
- When you type a period after a variable name in a statement, the VBA editor displays its properties, methods, and events. Double-click an item in the list to select it, or type the first few characters of the name and then press the comma, space bar, Enter, or close parentheses key.
- Type a single quote at the beginning of a line to add a comment to code. Everything from the quote to the end of the line is ignored.
- To add a subroutine or function, on the VBA menu, selectInsert>Procedure, which opens the Add Procedure dialog box where you specify the Name, Type, and Scope for the procedure.
Provide Feedback