In order to use VBA with a Microsoft Dynamics GP window, you’ll first need to add the window to your project. Adding a window creates a corresponding window object in your project, which you can reference in VBA.
To add a window object to your project, switch to Microsoft Dynamics GP and display the window you want to add. On the Tools menu, point to Customize, then choose Add Current Window to Visual Basic. This will add the currently-active (topmost) window to your project. The following illustration shows this menu:
Switch to the Visual Basic Editor and display the Project Explorer. It should look similar to the following:
You can continue to switch between the Visual Basic Editor and the main application to add windows as needed throughout your project’s development. When viewed in the accounting system, each window you’ve added to your project will appear with a period (.) at the end of the window’s title. This provides technical support and VBA developers with a visual cue that the window is part of the VBA project.
To remove a window object from your project, switch to Microsoft Dynamics GP and display the window you want to remove. On the Tools menu, point to Customize, then choose Remove Current Window From Visual Basic. VBA will remove the window and any window fields associated with the window.
Be sure you remove from your project all references to a window after you’ve removed it.