User FAQs

If you have a question, please send it to us.


1) What is the difference between these two blocks ?

frmUserForm.Show 

and

Load frmUserForm 
frmUserForm.Show

The explicit Load creates the userform and fires the Initialize event before the userform is displayed.
This allows you to define default behaviour and values before the userform is displayed.


2) What is the difference between these two blocks ?

Load frmUserForm 
frmUserForm.txtName = "hello"
frmUserForm.Show
Unload frmUserForm

and

Dim oForm As frmUserForm 
Set oForm = New frmUserForm
oForm.txtName = "hello"
oForm.Show
Unload oForm
oForm = Nothing

Declaring an instance of the userform is a more object oriented style.
This is not required unless you are creating multiple instances at the same time.


3) Is there a way to close a userform by pressing the ESC key ?
Yes. You need to change the "Cancel" property for the cancel button to the "True".
Make sure that the Cancel property for all the other buttons is set to False.


4) It is possible to display a userform in an exact position of the screen ?
Yes. You can use the Userforms Left and Top properties. In order for this to be effective you must set the StartUpPosition property to 0.


5) What is the difference between Hiding a userform and Unloading a userform ?
There is a big difference between Hiding a userform and Unloading it.
If you Hide a userform, it is not visible but still remains in memory.
Hiding a userform can be useful when it takes a while to initialise all the controls and the userform will be displayed more than once.
In this situation it will be quicker to hide and then show the userform, rather than unloading and loading.


6) Are there any other reasons you might hide the userform ?
One pattern that is often used is for the OK button to only hide the userform.

Private Sub btnOK_Click() 
   Me.Hide
End Sub

When you press the OK button the code after the frmUserForm.Show in the calling procedure will be executed.

Public Sub RunThis() 
   Load frmUserForm
   frmUserForm.Show
   MsgBox("runs after pressing OK")
End Sub

7) Should I prefix my controls with "Me." ?
Prefixing any reference to controls with Me helps to make your code more readable.

Private Sub btnOK_Click() 
   Me.txtName = "hello"
   txtName = "hello"
End Sub

8) Are there any userform best practices ?
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.
All userform controls should be prefixed with a consistent three character prefix (eg btn for command button).
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.
If you are using a checkbox to show/hide additional information, ticked should mean visible and unticked should mean hidden.


© 2026 Better Solutions Limited. All Rights Reserved. © 2026 Better Solutions Limited TopPrevNext