Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 923
Default Testing if Userform loaded

Hi All
How can I test if a userform is loaded in memory?

I have a userform that can be loaded and not visible or just not loaded.
Before I manipulate the controls on the form I need to determine if it is
memory.

Thank You

--
Cheers
Nigel




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Testing if Userform loaded

Hi Nigel,

If UserForms.Count = 0 Then
MsgBox "no forms are loaded"
End If

Regards,
Peter T

"Nigel" wrote in message
...
Hi All
How can I test if a userform is loaded in memory?

I have a userform that can be loaded and not visible or just not loaded.
Before I manipulate the controls on the form I need to determine if it is
memory.

Thank You

--
Cheers
Nigel






  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 923
Default Testing if Userform loaded

Hi
Thanks for the suggestion, in this case I think it will work. But I may
have more than one form and wanted something to test for a specific form
being in memory. Possible?

something like

If userform1.loaded then
do what i need to do
End If

--
Cheers
Nigel



"Peter T" <peter_t@discussions wrote in message
...
Hi Nigel,

If UserForms.Count = 0 Then
MsgBox "no forms are loaded"
End If

Regards,
Peter T

"Nigel" wrote in message
...
Hi All
How can I test if a userform is loaded in memory?

I have a userform that can be loaded and not visible or just not loaded.
Before I manipulate the controls on the form I need to determine if it is
memory.

Thank You

--
Cheers
Nigel








  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Testing if Userform loaded

' for testing
' x = UserForm2.Caption ' loads if not already

If UserForms.Count 0 Then
For i = 0 To UserForms.Count - 1
Debug.Print UserForms(i).Caption, UserForms(i).Visible
Next
End If

You could unload forms in the loop if necessary.

Regards,
Peter T

"Nigel" wrote in message
...
Hi
Thanks for the suggestion, in this case I think it will work. But I may
have more than one form and wanted something to test for a specific form
being in memory. Possible?

something like

If userform1.loaded then
do what i need to do
End If

--
Cheers
Nigel



"Peter T" <peter_t@discussions wrote in message
...
Hi Nigel,

If UserForms.Count = 0 Then
MsgBox "no forms are loaded"
End If

Regards,
Peter T

"Nigel" wrote in message
...
Hi All
How can I test if a userform is loaded in memory?

I have a userform that can be loaded and not visible or just not

loaded.
Before I manipulate the controls on the form I need to determine if it

is
memory.

Thank You

--
Cheers
Nigel










  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Testing if Userform loaded

Just to add, if unloading forms loop like this

If UserForms.Count 0 Then
For i = UserForms.Count - 1 To 0
Unload UserForms(i)

Peter T


"Peter T" <peter_t@discussions wrote in message
...
' for testing
' x = UserForm2.Caption ' loads if not already

If UserForms.Count 0 Then
For i = 0 To UserForms.Count - 1
Debug.Print UserForms(i).Caption, UserForms(i).Visible
Next
End If

You could unload forms in the loop if necessary.

Regards,
Peter T

"Nigel" wrote in message
...
Hi
Thanks for the suggestion, in this case I think it will work. But I may
have more than one form and wanted something to test for a specific form
being in memory. Possible?

something like

If userform1.loaded then
do what i need to do
End If

--
Cheers
Nigel



"Peter T" <peter_t@discussions wrote in message
...
Hi Nigel,

If UserForms.Count = 0 Then
MsgBox "no forms are loaded"
End If

Regards,
Peter T

"Nigel" wrote in message
...
Hi All
How can I test if a userform is loaded in memory?

I have a userform that can be loaded and not visible or just not

loaded.
Before I manipulate the controls on the form I need to determine if

it
is
memory.

Thank You

--
Cheers
Nigel














  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 923
Default Testing if Userform loaded

Thanks - works a treat

--
Cheers
Nigel



"Peter T" <peter_t@discussions wrote in message
...
Just to add, if unloading forms loop like this

If UserForms.Count 0 Then
For i = UserForms.Count - 1 To 0
Unload UserForms(i)

Peter T


"Peter T" <peter_t@discussions wrote in message
...
' for testing
' x = UserForm2.Caption ' loads if not already

If UserForms.Count 0 Then
For i = 0 To UserForms.Count - 1
Debug.Print UserForms(i).Caption, UserForms(i).Visible
Next
End If

You could unload forms in the loop if necessary.

Regards,
Peter T

"Nigel" wrote in message
...
Hi
Thanks for the suggestion, in this case I think it will work. But I
may
have more than one form and wanted something to test for a specific
form
being in memory. Possible?

something like

If userform1.loaded then
do what i need to do
End If

--
Cheers
Nigel



"Peter T" <peter_t@discussions wrote in message
...
Hi Nigel,

If UserForms.Count = 0 Then
MsgBox "no forms are loaded"
End If

Regards,
Peter T

"Nigel" wrote in message
...
Hi All
How can I test if a userform is loaded in memory?

I have a userform that can be loaded and not visible or just not

loaded.
Before I manipulate the controls on the form I need to determine if

it
is
memory.

Thank You

--
Cheers
Nigel














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
Keeping an add-in loaded glyn Excel Programming 1 March 2nd 06 03:43 PM
Extracting Colors from Image loaded in userform emsfeld Excel Programming 6 June 4th 04 04:05 PM
how to know if a xla is 'loaded' Isabelle Robin Excel Programming 5 March 5th 04 11:07 AM
Excel: VBA userform is shown but not loaded/initialized even though it was first unloaded? Luisa[_2_] Excel Programming 2 December 5th 03 08:15 AM
Detecting if a userform is loaded Seth[_5_] Excel Programming 2 November 4th 03 02:59 AM


All times are GMT +1. The time now is 01:24 AM.

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"