Modal User Form

  • Thread starter Thread starter Jim M
  • Start date Start date
J

Jim M

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
 
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 (e-mail address removed)
 
Back
Top