If you are opening a window in Dynamics GP and it is just causing Dynamics GP to instantly crash, then it is likely that VBA is the cause.

This is usually experienced immediately after an upgrade, either of the server, or the Dynamics GP client, where it used to work fine just before the upgrade.

There are pretty much two different options to resolve this, but first, let me take you through the steps necessary to find out whether this window actually does have VBA attached.

Go to the Customisation Maintenance Window via the following menu:

Microsoft Dynamics GP >> Tools >> Cusomise >> Customisation Maintenance


Cusomisation Maintenance Menu

When it opens, it will display all of the customisations that are currently active in your client setup.

It will look something like this:


Cusomisation Maintenance Window

To find the cause, take a look in your list of customisations, and see if you are able to spot any where the type says Form with VBA.

If you can find a match in one of those 'with VBA' entries to the window that you are trying to open, just before Dynamics GP crashes, then you have most likely confirmed that VBA is the cause.


How to fix the issue of Dynamics GP crashing when VBA is the cause

You basically have three options to deal with this, and I recommend starting with step 1, but if that is not possible or doesn't work, then either step 2 or step 3 will be needed.

Step 1 - Turn of Data Execution Prevention for Dynamics.exe

What is sometimes the issue is the that the Data Execution Prevention (DEP). It is understood that the DEP this is designed to try and stop viruses running on the machine. Because of that, it seems to think that the VBA running in DYNAMICS.EXE is a virus, and Dynamics GP crashes.

Here is how to prevent the DEP from getting involved by turning off DEP for Dynamics.exe:

  • In File Explorer, right click on This PC and select properties.
  • Click on Advanced System settings
  • Click on Advanced tab
  • Click on Performance > Settings
  • Click on Data Execution Prevention
  • Click Add and pick the Dynamics.exe file from your client install folder (found somewhere like this C:Program Files (x86)Microsoft DynamicsGP).
  • Make sure the checkbox is ticked and then click Apply.

Once selected, it will show up as Microsoft Dynamics GP:


Add Dynamics exe to DEP

Now, open Dynamics GP again, and try opening that same window or report and see if it works, or if Dynamics GP still crashes.

If Dynamics GP still crashes, then you will need to decide on one of the following two options, which depend entirely on whether you need the functionality performed by the VBA, or if you can do without it:

  • Remove the VBA - this is only an option if you don't need the functionality of the VBA
  • Changing the VBA to Deterity - this option is if you need the functionality


Option 1 - Remove VBA from the Dynamics GP window

If you are considering this option, then you will first need to determine whether you need the functionality that the VBA was designed for. Unless it is obvious and you already know what the VBA was supposed to do, you may need to take a look at the VBA to see. If you are not sure and are not familiar with VBA, then you will need to get an expert to take a look.

To get to the VBA, you need to do to the following Dynamics GP menu (if you have access to it):

Microsoft Dynamics GP >> Customise >> Visual Basic Editor

This will open the VBA editor. (But, if VBA is an issue, then the Visual Basic Editor may not open either...)

Now, you will need to find and expand the Microsoft_Dynamics_GP section, and then also the 'Microsoft Dynamics GP Objects'. Within that section, double click on the window name, which will open the VBA code for inspection.

Note: if the window has a grid or table within it, then there may be two Objects showing in that list, the one will be for the grid and will have (grid) as the suffix to the name, and the other will have (Window) as the suffix. Try opening both, as functionality could have been added to either.

Once you have determined what the functionality does, and that you are happy that you do not want it, then you need to remove it from your setup.

Remove the VBA customisation from your client

Go back the Customisation Maintenance window:

Microsoft Dynamics GP >> Tools >> Customise >> Customisation Maintenance

Now follow these steps:

  1. To create a backup of all of the customisations, select ALL the customisations (select any record in the customisation maintenance window, then press ctrl + A)
  2. Now click on the Export button in the menu.
  3. Find a suitable export path for this file, and give it a name of something like AllCustomisations.package. The name is not important for anything other than identifications later, but the extension MUST be .package.
  4. Now, repeat step 1 above, selecting all the customisations, and then, while holding down the ctrl key, click on the window with the type 'Form with VBA' that you want to remove, this will de-select it from the list and make it the only one that is NOT selected.
  5. Again, click on Export, but this time, change the name to something else, such as AllCustomisationsExcludingXXX.package. This file will contain all the other customisations on your client.
  6. Ensure that Dynamics GP is closed before the next step, and if you are using shared client or shared customisation dictionaries (i.e. all users are using the same modifications), then ensure that ALL users have also logged out of Dynamics GP when you do the next few steps. This will prevent locks on the modification files when you try to import the customisations again...
  7. Remove the customisations files from your client: using windows exporer, go to the installation directory (e.g. C:Program Files (x86)Microsoft DynamicsGP).
  8. Make a copy of this entire 'GP' folder (or whatever yours is called) as a backup. It is the simplest way to restore your client back to it's original status.
  9. Within the GP folder, delete the Dynamics.vba file. (Hint: You will know that there is VBA in that file if it is larger than 4Kb)
  10. Now, log back into Dynamics GP
  11. Go back to the Customisation Maintenance winow (Microsoft Dynamics GP >> Tools >> Customise >> Customisation Maintenance)
  12. Now, take a quick browse down the list, and you should no longer see any of those records showing 'with VBA'.
  13. Click on Import, and select the second file you exported earlier (the one excluding the window).
  14. It may tell you that there are various customisations that will be updated, but that is OK. Confirm the selection to complete the import. You should see a message saying that all the customisations have been successfully imported. If the import was unsuccessful, then this is usually because other users are locking the modification files - make sure that they are all logged out properly, and try this again.
  15. Now, once the Dynamics GP modifications (excluding the one you wanted to remove) have been successfully imported, then try to open that window again.

Option 2 - upgrade the VBA from the Dynamics GP window to Dexterity

If you really need the functionality that was added to the window using VBA, and the DEP exception did not resolve the issue for you, then I recommend getting the functionality duplicated in Dexterity.

For those who don't know, Deterity is a programming language that Microsoft Dynamics GP was written in.

Many organisations have functionality added using Dexterity, for a variety of reasons, and these are included as additional modules.

If you need to go down this route, then contact your reseller, or if they are not able to assist you with this (i.e. they don't have the expertise), then feel free to get in touch with us, and we can work with you to get this functionality transferred from VBA into Deterity, and make your Dynamics GP setup more future-proof.