Modal User Form

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
 
C

Chip Pearson

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top