As a document is loaded, an application looks for code marked to execute when the document is opened. This code may open a dialog box, make changes to the menu and in many other ways customize the interface of the application. This step alone can make a general application such as Access appear to be a custom program.
Furthermore, some code contained in a document may also attach to “events” of an application. For example, code can attach to special key combinations.
Code may also attach to the “document close” event so that document specified code can execute as a document is closed.