Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default 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
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
Userform Initialize [email protected] Excel Programming 4 August 7th 07 06:01 AM
UserForm initialize event run when UserForm is shown [email protected] Excel Programming 2 June 13th 07 02:49 AM
UserForm initialize Arne Hegefors Excel Programming 8 September 8th 06 01:48 PM
userform initialize Patrick Simonds Excel Programming 1 August 4th 06 11:14 PM
initialize userform, using a sub natanz[_2_] Excel Programming 11 November 22nd 05 05:30 AM


All times are GMT +1. The time now is 07:26 PM.

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

About Us

"It's about Microsoft Excel"