Can't show non-modal form when modal form is displayed

C

Cooz

Hi everyone,

I have a modal userform that contains a button (among other controls). When
a user clicks this button, another, modeless userform (frmHelp) should be
displayed that contains information about the first form. It would be nice if
users were able to access the first form while this information is still
shown - hence the choice for modeless display.

Clicking the button results in run time error 401: Can't show non-modal form
when modal form is displayed. Both setting the ShowModal property of frmHelp
at design time to False and 'frmHelp.Show vbModeless' yield the error.

Is there any way to bypass this error and have the second form displayed
modeless just the same? Displaying the first form modeless works, but in this
way users can get at the Word document, which is out of the question.

I use Word 2003.

Thank you,
Cooz
 
M

Manfred F

Hi Cooz,

Cooz said:
Is there any way to bypass this error and have the second form displayed
modeless just the same? Displaying the first form modeless works, but in this
way users can get at the Word document, which is out of the question.

I don't know, but I don't believe there is a way. Modal forms come use the
global execution context, modeless ones use their own context. You can't mix
that up, probably.
What You could do is
- use msgbox or
- dynamically change Your primary form to show help info.

Regards,
Manfred
 
J

Jean-Guy Marcil

Cooz said:
Hi everyone,

I have a modal userform that contains a button (among other controls). When
a user clicks this button, another, modeless userform (frmHelp) should be
displayed that contains information about the first form. It would be nice if
users were able to access the first form while this information is still
shown - hence the choice for modeless display.

Clicking the button results in run time error 401: Can't show non-modal form
when modal form is displayed. Both setting the ShowModal property of frmHelp
at design time to False and 'frmHelp.Show vbModeless' yield the error.

Is there any way to bypass this error and have the second form displayed

Short answer is "no".
You are going to have to find another way of doing this.

Here are two suggestions:

1) Use a MultiPage Control.
Have one page with the controls and another with the help info. THis way
users can quickly go from one page to the other.
2) If the userform is not too big and the help short, use the "More..."
system, like we see in the Find dialog. Add a "Show Help" button that wil
make the userform bigger and display the help text at the bottom. The button
caption would then change to "Hide Help"...
 
G

Gordon Bentley-Mix

Hmm... I quite like the idea of the "Show / Hide Help" button Jean-Guy. I
might look into using this in some future project. Thanks for the idea!

-----
Cheers!

Gordon

Uninvited email contact will be marked as SPAM and ignored. Please post all
follow-ups to the newsgroup.
 
J

Jean-Guy Marcil

Gordon Bentley-Mix said:
Hmm... I quite like the idea of the "Show / Hide Help" button Jean-Guy. I
might look into using this in some future project. Thanks for the idea!

You are welcome!

I have done it before, and if done right, it looks very neat and professional.

You do have to test for all kinds of screen resolutions and make sure you
can adapt to those varying user-set environments...
 

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