It is possible to create modeless (as well as modal) dialog boxes.
Modeless dialog boxes allow the user to continue to work in the application while the form is still displayed.
By default all userforms are displayed as modal which means that the user must close the userform before they can continue to use the application.
When the UserForm is modeless, the user can view other forms or windows without closing the UserForm.

Userform1.Show ([modal]) 

modal - A boolean value that determines if the userform is displayed as a modal userform or a modeless userform.

Userform1.Show (VBA.FormShowConstants.vbModeless) 
Userform1.Show (0)

Sub Macro1() 
   Load UserForm1
   UserForm1.Show (VBA.FormShowConstants.vbModal)
End Sub

VBA.FormShowConstants.vbModal = 1
VBA.FormShowConstants.vbModeless = 0

ShowModal property

The default value for this property is True which will display the userform in a modal mode.
You can change this to False if you would rather display the userform in a modeless mode.

microsoft excel docs

Combining with RefEdit

Make sure you do not use a modeless form in combination with the RefEdit control for inputting cell ranges.
Otherwise Excel loses control over the keyboard focus and can only be terminated through brute force (task manager or Ctrl + Alt + Delete)


If you attempt to open a UserForm that has a ShowModal property in Microsoft Office 97, you get a run-time error because Office 97 only displays modal UserForms.
When a UserForm is modeless, subsequent code is executed as it's encountered. Modeless forms do not appear in the task bar and are not in the window tab order.

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