LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 371
Default Show and Hide Forms

Hi
I am having unpredictable results with Hide, Show and Unload in 4
non-dependent userforms: frmInput, frmAllocate, frmReport, frmPrint. On each
form are Hide and Quit (=unload) cmdbuttons. On a wsheet is a single
'Reveal' cmdbutton and cmdbuttons to invoke each form.

In each Hide button the code is simply:
Private Sub cmdHide_Click()
frmReports.Hide 'frmReports for example
End Sub

The wsheet 'Reveal' button is:
Sub RevealForm()
If UserForms.Count 0 Then
UserForms(0).Show 'Reveal hidden form
Else
MsgBox "No forms hidden."
End If
End Sub

When unloading say frmReport, frmInput is often loaded but not shown.
This means none of the forms can be shown as in each of the wsheet cmdbutton
which calls the forms is (frmInput by example):
If UserForms.Count 0 Then
If UserForms(0).Name = "frmInput" Then formname = "Input"
If UserForms(0).Name = "frmAllocate" Then formname = "Allocate"
If UserForms(0).Name = "frmReport" Then formname = "Report"
If UserForms(0).Name = "frmPrint" Then formname = "Print"
MsgBox "'Input Data' error" & vbCr & vbCr & _
"The " & formname & " form is still open. "
Exit Sub 'This passes code to Show form being executed
End If

There is no point in leaving forms loaded as it can be a while before
another utility is needed.
Can anyone suggest where I might be going wrong or if there is a better
strategy please?

T.I.A

Geoff

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Making the forms scroll bar show - figures. Martc Excel Worksheet Functions 2 May 2nd 07 11:12 AM
How can I hide check box created via FORMS together with column? Max Excel Discussion (Misc queries) 3 March 25th 05 08:49 PM
How do I hide the outline of a Forms Group Box? MadTodd Excel Discussion (Misc queries) 7 January 17th 05 05:45 PM
Can you hide forms checkboxes Matt Excel Programming 2 January 10th 04 06:32 PM
how do you hide a forms command button Paul James[_3_] Excel Programming 4 September 5th 03 06:18 PM


All times are GMT +1. The time now is 11:33 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"