![]() |
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 |
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 |
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 |
All times are GMT +1. The time now is 05:22 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com