Following on from my previous post: Customising the Company Login window series Part 1 - Introduction, here is the method to create a solution using Visual Basic for Applications (VBA).
As discussed in the earlier post, the problem we are trying to overcome is that the company drop down list on the Company Login window is not wide enough to show a long company name. This can make it difficult to select the correct company when the company names are long and differ only by some characters at the end of the name.
Below is a screenshot of the original window from Microsoft Dynamics GP 2013.
Following are the step by step instructions on how to use Visual Basic for Applications (VBA) code to "modify" the window:
Here is a screen shot of the window with the full 230 pixel adjustment:
Below is the code used:
Private Sub Window_BeforeOpen(OpenVisible As Boolean) Dim Adjust As Integer Adjust = 230 Company.Left = Company.Left - Adjust Company.Width = Company.Width + Adjust Rememberthiscompany.Left = Rememberthiscompany.Left - Adjust Rememberthiscompany.Width = Rememberthiscompany.Width + Adjust Server.Left = Server.Left - Adjust Server.Width = Server.Width + Adjust UserID.Left = UserID.Left - Adjust UserID.Width = UserID.Width + Adjust CurrentUsers.Left = CurrentUsers.Left - Adjust 'CurrentUsers.Width = CurrentUsers.Width + Adjust UsersAllowed.Left = UsersAllowed.Left - Adjust 'UsersAllowed.Width = UsersAllowed.Width + AdjustEnd Sub
The VBA package for this customisation is attached to the bottom of this article. You can use Tools >> Customize >> Customization Maintenance to load the package.
Thanks to Patrick Roth and Aaron Berquist for their feedback on this customisation.
Hope you find this useful and educational.
Post from Mark Polino at DynamicAccounting.net
This customization comes in just handy.. since our company has been acquired, I have to look into renaming all our GP companies and they will all start with the same lengthy prefix 'Ultra Electronics', which adds another 20-something characters and thus render the list unreadable from the pull-down menu..
I've tried to import your package into my test bed system to see if it works, and even after following your directions and setting the Options for the variable declarations, every time I switch company I get an error about permission denied. When clicking on the Debug button, it stops on the line 'UsersAllowed.Left = UsersAllowed.Left - Adjust
any ideas where to fix this ? I thought that there is no need to select the GP security for alternate forms ?
Comment out that line and see if it works.
What version are you using? This was coded against GP 2013 SP2.
PLEASE READ BEFORE POSTING
Please only post comments relating to the topic of this page.
If you wish to ask a technical question, please use the links in the links section (scroll down, on right hand side) to ask on the Newsgroups or Forums. If you ask on the Newsgroups or Forums, others in the community can respond and the answers are available for everyone in the future.