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:
  1. In the
    Microsoft
    VBA IDE, in the code window, type the code for the event handler between the
    Sub
    and
    End Sub
    statements, .
  2. Select
    File
    >
    Save
    , to save display with the subroutine.
  3. To test the event handled, select
    Run
    >
    Run Sub/User Form
    . When the event is fired, the code will run.
  4. In the
    Graphics
    editor 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, select
    Insert
    >
    Procedure
    , which opens the Add Procedure dialog box where you specify the Name, Type, and Scope for the procedure.
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.
Normal