Well, I had been absent (more like out of ideas) from writing any new VBA articles. The truth is, they are hard to come by without giving away too many secrets. 🙂
However, this one is worth giving away as I have seen many users request this feature to speed up data entry and processing. Take for example the Purchase Order Entry window. Won’t you just like the ability to press some combination of keys on your keyboard to quickly access the Vendor Detail Entry window where you can quickly change around shipping methods, or other information needed? Well this example shows just that, but can be used to add shortcuts to any other button control in any other Dynamics GP window.
The solution is simple:
1) Add a pixel size button to the window with Modifier.
2) Caption the button. Buttons can have captions preceeded with the ampersand (“&”) character, which in turn acts like a shortcut when used in combination with the Alt key on the keyboard.
As a personal choice, I captioned the button with &4, as the expansion button is Expansion Button 4.
3) In addition, we can change the button’s Visual properties to blend it in with the expansion button. I particularly prefer to stack these shortcut buttons on top of or next to the expansion button they will serve as a shortcut for.
4) The button can then be added to VBA where code can be written to force the execution the expansion button Change script. To run the Expansion Button 4 change script that will open the window, we use the Dynamics Continuum Integration library and pass-through Dexterity Sanscript.
The following — and much simpler! — code will also do the trick for you non-Dexterity developers:
You will need to add the expansion button to VBA in addition to the pixel size button for the above code to work.
Very simple! Now when you go to the Purchase Order Entry screen, enter PO number and select a vendor, you can press Alt + 4 on the keyboard to open the associated window to the Vendor ID expansion button.
Hope you find this sample project useful.
v10 – Sample Expansion Button shortcut package file – click here.
Until next post!
Mariano Gomez, MVP
Maximum Global Business, LLC