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 contine to use the application.
When a UserForm is modal, the user must supply information or close the userform before using any other part of the application. No subsequent code is executed until the userform is hidden or unloaded.
Although other forms in the application are disabled when a userform is displayed, other applications are not.
When the UserForm is modeless, the user can view other forms or windows without closing the UserForm.
modal - A boolean value that determines if the userform is displayed as a modal userform or a modeless userform.
Userform1.Show (1) 'this is the default
VBA.FormShowConstants.vbModal = 1
VBA.FormShowConstants.vbModeless = 0
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.
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.
© 2021 Better Solutions Limited. All Rights Reserved. © 2021 Better Solutions Limited TopPrevNext