Removing References to Fields in VBA Revisited

Michael Johnson (the MBS Guru) has posted a great article about removing invalid references from a Visual Basic for Applications (VBA) project. This has prompted me to revisit the topic and gather together all the relevant resources from a number of blog authors.

A few months back, Mohammad Daoud published a post on the same subject. His method of removing the window from VBA and re-adding the window and fields back to VBA is the supported method for removing references to fields that no longer exist on the window.

Below are the links to the his article and some of my thoughts at the time:

However, what happens when you have a VBA customization with many fields added to VBA and only one or two that have been removed and are now causing errors?

You might remember how the Action Button replaced a number of other buttons in the v10.0 Sale Transaction Entry window. This means that if the old Transfer, Delete, Post buttons etc. were previously added to VBA, they would now cause invalid reference errors. See the links are the bottom of this post for more information on the Action Button.

Michael recently faced this situation when upgrading a site to v10.0. There were over 60 other fields added to VBA. Using the method mentioned in the previous articles would have required a huge effort to manually add the 60 fields back to VBA. So Michael used a technique which has been mentioned before and manually edited the exported package file with Notepad.exe. For the details, please see his post:

NOTE: The technique described here directly modifies the contents of a customization package with Notepad. This technique is not supported by Microsoft Dynamics GP support.

For information on changing VBA or Dexterity code to work with the Action Button in the v10.0 Sales Transaction Entry (SOP_Entry) window, have a look at these related posts from Mariano Gomez and myself: