A window event executes a specific VBA procedure (an event procedure) when a user opens, closes or activates a window, or when a message dialog appears for the window. To view the window events available, select a Microsoft Dynamics GP window object in your project, then display the Visual Basic Code window. Select Window in the Object list; window events will appear in the Procedure list.
A window event executes an event procedure either before or after Microsoft Dynamics GP application code runs for the same event. Therefore, window events use names like “BeforeClose” to indicate that the event runs as the window closes but before Microsoft Dynamics GP application code runs for the window. When you choose an event, VBA automatically adds the event procedure syntax to the Code window.
If you use VBA with a window you’ve modified using the Modifier, you must set the EventMode property to emModified if you want events to occur for the modified window. To change the EventMode property for the window object, use the Visual Basic Properties window.
If you delete a modified window from your forms dictionary (or delete the forms dictionary altogether), all VBA references to new fields you add to the modified window will be invalid. If you re-create the modified window, then re-add the new fields using the Modifier, you’ll need to re-add those same fields to your VBA project and re-create any VBA customizations that reference the new fields.