Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 156
Default Hiding a Form that's not open

I suspect you can only run

Form1.Hide

when Form1 is open.

I'm getting run time error 380, even with

On Error GoTo 0
Form1.Hide
On Error Resume Next

So, how do you determine if Form1 is Open, so the Hide command can be
conditional ?

Thanks - Kirk
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Hiding a Form that's not open

if form1.visible then
Form1.Hide
endif


"kirkm" wrote:

I suspect you can only run

Form1.Hide

when Form1 is open.

I'm getting run time error 380, even with

On Error GoTo 0
Form1.Hide
On Error Resume Next

So, how do you determine if Form1 is Open, so the Hide command can be
conditional ?

Thanks - Kirk

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Hiding a Form that's not open

if form1.visible then

That would load the form causing it's initialize event to run if the form
was not already loaded.

Sub test()
Dim frm As UserForm
If Form1.Visible Then
Form1.Hide
End If
For Each frm In UserForms
If frm Is Form1 Then
If Form1.Visible Then
Form1.Hide
End If
'to destroy the form as well
' Unload frm
' or Unload Form1
' these will trigger Queryclose and, if not Cancel= true in Queryclose,
Terminate events
End If
Next
End Sub

Sub showform()
' userform named Form1
Form1.Show vbModeless
End Sub



Regards,
Peter T
"Harbinger" wrote in message
...
if form1.visible then
Form1.Hide
endif


"kirkm" wrote:

I suspect you can only run

Form1.Hide

when Form1 is open.

I'm getting run time error 380, even with

On Error GoTo 0
Form1.Hide
On Error Resume Next

So, how do you determine if Form1 is Open, so the Hide command can be
conditional ?

Thanks - Kirk



Reply
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
Using a template form, advance a form number everytime you open ShoDan Excel Discussion (Misc queries) 1 January 31st 08 01:34 PM
Hiding a form Dan Perkins Excel Programming 4 September 22nd 06 07:40 PM
User form and hiding spreadsheet Chip Smith Excel Discussion (Misc queries) 0 March 29th 06 07:46 PM
Form not hiding LB79 Excel Discussion (Misc queries) 6 August 24th 05 02:34 PM
Is it possible to open the VBA form with a link in a sheet and to pass variable from a cell to the VBA form? Daniel[_14_] Excel Programming 1 August 29th 04 01:20 PM


All times are GMT +1. The time now is 10:10 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"