Unload vs Hide

C

CV323

I have 4 userforms

From the main menu - click on button1

Private Sub CommandButton1_Click()
Headcount.Show
MainMenu.Hide
End Sub

Works Fine!
====
from the Headcount form, if you click on the MainMenu button

Private Sub CommandButton25_Click()
Headcount.Hide
MainMenu.Show
End Sub

I get Run-time Error: '400'
"Form already displayed, can't show modally"

In Properties, ShowModal = True

I'm stuck - I've also tried Load and Unload and cannot find a way around this.

Thanks for any help!
 
F

FSt1

hi.
the form is already showing as excel understands. the form is in memory just
hidden. so don't try to show it again. unhide it.
Private Sub CommandButton25_Click()
Headcount.Hide
MainMenu.Unhide
End Sub

regards
FSt1
 
J

JLGWhiz

MainMenu.Visible = True might work better.

FSt1 said:
hi.
the form is already showing as excel understands. the form is in memory just
hidden. so don't try to show it again. unhide it.
Private Sub CommandButton25_Click()
Headcount.Hide
MainMenu.Unhide
End Sub

regards
FSt1
 
J

JLGWhiz

The UserForm can use Hide and Show. The Controls on the UserForm and Tool
Bars use the <TypeControl>.Visible = <Boolean> 'True or False
 
C

CV323

Thank you - both of you.

JLGWhiz said:
The UserForm can use Hide and Show. The Controls on the UserForm and Tool
Bars use the <TypeControl>.Visible = <Boolean> 'True or False
 
C

CV323

When I used this:

Headcount.Hide
MainMenu.Visible

The following error: "Function or interface marked as restricted..."

Then:
Headcount.Hide
MainMenu.Unhide

Error: "Method or data member not found"
 
J

JLGWhiz

MainMenu.Visible = True 'Show the menu bar
MainMenu.Visible = False 'Hides the menu bar

Headcount.Hide 'Hides the UserForm
Headcount.Show 'Shos the UserForm
Unload Headcount 'Closes the UserForm
 

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