Hi Marie,
Welcome to the forum.
"CApp" refers to a Class Module that is added to the VBA Project for your display.
To get this to work you need to:
- Go to VBA editor (Alt+F11).
- Select "Insert" then "Class Module".
- Name this "CApp".
- Paste in the code:
Code:
Public WithEvents test As Application
Private Sub test_AfterModeChange(ByVal bRunMode As Boolean)
Debug.Print "AfterModeChanged"
End Sub
Private Sub test_BeforeModeChange(bCancel As Boolean)
Debug.Print "BeforeModeChanged"
End Sub
- Within the "ThisDisplay" object, paste the code:
Code:
Dim app As CApp
Private Sub Display_Open()
Set app = New CApp
Set app.test = Application
End Sub
- Put the VBA cursor somewhere in the "Display_Open" event code (just click in it).
- Hit "F5" to run through the code (simulates when you open the display).
Now when you change mode you will get some messages in your immediate window.
Hope this helps.
Principal Consultant
Real-Time Data Management @ Wipro Technologies