Best Practices
Prefix any reference to controls with Me to make it explicit.
All userforms and messages should have a distinctive title so they can be easily identified by the user and when debugging.
Always put dialog boxes in the middle of the screen (even when multiple screens) save in registry - problems when monitors are moved
All userforms should have their position saved in the registry to allow for multiple screens.
Userforms should load quickly
Prompt the user (to save) if there have been any changes to any information
Cancel, Escape and X should all call the btnCancel_Click subroutine.
Have consistent Cancel (or Close) buttons throughout your application.
Controls
All userform controls should be prefixed with a consistent three character prefix (eg btn for command button).
All controls should be renamed even for the most simple userforms.
Labels that are used as static text do not have to be renamed assuming they are not referenced anywhere in the code.
Rename all the controls before writing any code. Code is linked to a control by its name so if its name changes you will have an orphaned event handler.
Control toolbox - buttons - if the project doesn't compile then the Edit button does not appear on the Assign Macro dialog box - it is displayed as New
DateTime Control - always use custom date format "dd mmmm yyyy dd"
If you are using a checkbox to show/hide additional information, ticked should mean visible and unticked should mean hidden.
© 2025 Better Solutions Limited. All Rights Reserved. © 2025 Better Solutions Limited TopPrevNext