Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
UserForm Initialize Problem
Duuuuudes:
Is there a way to check if a userform, created with vba, running inside of Excel 03' is visible without the userforms initialize event running? Thanks. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
UserForm Initialize Problem
use this macro
sub test() 'You can initialize variable here userform1.listbox1.text = "Hello" userform1.show end sub "DeathSurfer" wrote: Duuuuudes: Is there a way to check if a userform, created with vba, running inside of Excel 03' is visible without the userforms initialize event running? Thanks. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
UserForm Initialize Problem
thanks for the reply Joel but I need to know if I can check a form's
visibility status without the initialize event running on the form. I guess this can't be done because the form has to load into memory before it can check the visibility status. "Joel" wrote: use this macro sub test() 'You can initialize variable here userform1.listbox1.text = "Hello" userform1.show end sub "DeathSurfer" wrote: Duuuuudes: Is there a way to check if a userform, created with vba, running inside of Excel 03' is visible without the userforms initialize event running? Thanks. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
UserForm Initialize Problem
You can check if it is loaded, but if you refer to it, it gets loaded.
A workaround would be to use the findwindow API function. Something like: Sub CheckForm() Dim hWnd As Long hWnd = FindWindow(vbNullString, "MyUserform Caption") If hWnd = 0 Then MsgBox "not visbile" Else MsgBox "Visible" End If UserForm1.Show vbModeless hWnd = FindWindow(vbNullString, "MyUserform Caption") If hWnd = 0 Then MsgBox "not visbile" Else MsgBox "Visible" End If End Sub The above code obviously loads the userform (and fires the initialize event), but it is just to demonstrate usage. -- Regards, Tom Ogilvy "DeathSurfer" wrote: Duuuuudes: Is there a way to check if a userform, created with vba, running inside of Excel 03' is visible without the userforms initialize event running? Thanks. |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
UserForm Initialize Problem
Thanks Dude.
"Tom Ogilvy" wrote: You can check if it is loaded, but if you refer to it, it gets loaded. A workaround would be to use the findwindow API function. Something like: Sub CheckForm() Dim hWnd As Long hWnd = FindWindow(vbNullString, "MyUserform Caption") If hWnd = 0 Then MsgBox "not visbile" Else MsgBox "Visible" End If UserForm1.Show vbModeless hWnd = FindWindow(vbNullString, "MyUserform Caption") If hWnd = 0 Then MsgBox "not visbile" Else MsgBox "Visible" End If End Sub The above code obviously loads the userform (and fires the initialize event), but it is just to demonstrate usage. -- Regards, Tom Ogilvy "DeathSurfer" wrote: Duuuuudes: Is there a way to check if a userform, created with vba, running inside of Excel 03' is visible without the userforms initialize event running? Thanks. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Userform Initialize | Excel Programming | |||
UserForm initialize event run when UserForm is shown | Excel Programming | |||
UserForm initialize | Excel Programming | |||
userform initialize | Excel Programming | |||
initialize userform, using a sub | Excel Programming |