ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Modal User Form (https://www.excelbanter.com/excel-programming/281498-modal-user-form.html)

Jim M[_3_]

Modal User Form
 
I am trying to design a user form to function as a "Accept
our Terms" form the first time someone opens the file. I
have the ShowModal Property of the form set to True and
use the following code to load the form:

Sub Auto_Open()

If NotAccepted Then frmAgree.Show (vbApplicationModal)

The form loads OK but you can then click on the underlying
worksheet and work normally with the user form still
open. Shouldn't this force the user form to have to be
closed before the worksheet can be accessed?

Thanks
Jim

Chip Pearson

Modal User Form
 
Jim,

You are using the wrong constant. The two constants for the modality of
forms are vbModal and vbModeless. The value of vbModeless and the value of
vbApplicationModal are the same, so your code is showing the form
modelessly.

Change vbApplicationModal to vbModal.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Jim M" wrote in message
...
I am trying to design a user form to function as a "Accept
our Terms" form the first time someone opens the file. I
have the ShowModal Property of the form set to True and
use the following code to load the form:

Sub Auto_Open()

If NotAccepted Then frmAgree.Show (vbApplicationModal)

The form loads OK but you can then click on the underlying
worksheet and work normally with the user form still
open. Shouldn't this force the user form to have to be
closed before the worksheet can be accessed?

Thanks
Jim





All times are GMT +1. The time now is 01:26 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com