VBA - Screen Size and Position Example

The following VBA example allows a window to remember its size and position the next time it is opened.  This is really handy for transaction windows that you would like to see more lines at one time.

The code uses the DUOS (Dynamics User Object Store) to store the settings for each window on a per user basis.  As the DUOS table is already per company, the resulting data is stored per user per company.

The example uses the POP PO Entry window, however the code is generic (because it uses the Me object to refer to the current window) and so can be copied between windows.  The window is not modified in any way and you only need to add the window to Visual Basic, there is no need for any fields to be added to Visual Basic. 

If you are registered for the Customization Site License only and do not have the Modifier & VBA registered, it is possible to use notepad.exe to modify the package file to import it against different windows.

NOTE: The window position is not correctly remembered for v10.0 until SP2, due to a bug.

Example code for v8.0, v9.0 & v10.0 is attached at the bottom of the article.

Please see the "Installation Instructions.txt" file in each version's archive for more information.

 

For some related window size and position posts, see the following articles:

David

09-Oct-2013: Added links to related articles.

ScreenSizeExample.zip