View - Events - View Code
Ribbon bar. Select the View tab. In the Display group, click Events and from the menu, select View Code.
Classic menus. From the View - Events submenu, select View Code.
This displays the Document Events window, which is used to enter code to change the default behavior of document-level events. With document-level events, you can customize the behavior of open documents.
The Object drop-down box contains two options, (General) and Document. These options toggle between document and global declarations. If the Object box is set to (General), you are able to enter global variables, external library inclusions, and API declarations. If the Object box is set to Document, then the Proc box contains a list of possible events for the current document. Select the event that you want to edit from the Proc box (example, BeforeDoubleClick). The corresponding function can then be written into the body of the Document Events window for you to edit.