ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How check if form is loaded? (https://www.excelbanter.com/excel-programming/321819-how-check-if-form-loaded.html)

Jos Vens[_2_]

How check if form is loaded?
 
Hi,

is it possible to check if a specific form is loaded into memory?

Thanks,
Jos Vens



Fredrik Wahlgren

How check if form is loaded?
 

"Jos Vens" wrote in message
...
Hi,

is it possible to check if a specific form is loaded into memory?

Thanks,
Jos Vens



It's possible to test whether a form is being shown. That's perhaps not what
you meant.

/Fredrik



Jos Vens[_2_]

How check if form is loaded?
 
Hi Fredrik,

yes it is, I just want to test if a form is shown or not but how?

Thanks
Jos

"Fredrik Wahlgren" schreef in
bericht ...

"Jos Vens" wrote in message
...
Hi,

is it possible to check if a specific form is loaded into memory?

Thanks,
Jos Vens



It's possible to test whether a form is being shown. That's perhaps not
what
you meant.

/Fredrik





Michel Pierron

How check if form is loaded?
 
Hi Jos,

Private Function FormIsLoaded(UFName As String) As Boolean
Dim UF As Integer
For UF = 0 To VBA.UserForms.Count - 1
FormIsLoaded = UserForms(UF).Name = UFName
If FormIsLoaded Then Exit Function
Next UF
End Function

Sub Test()
'Load UserForm1
MsgBox FormIsLoaded("UserForm1"), 64
'If FormIsLoaded("UserForm1") Then Unload UserForm1
End Sub

Regards,
MP

"Jos Vens" a écrit dans le message de
...
Hi,

is it possible to check if a specific form is loaded into memory?

Thanks,
Jos Vens




Jos Vens[_2_]

How check if form is loaded?
 
Thanks a lot Michel!

Your code does the job I wanted,

Jos


"Michel Pierron" schreef in bericht
...
Hi Jos,

Private Function FormIsLoaded(UFName As String) As Boolean
Dim UF As Integer
For UF = 0 To VBA.UserForms.Count - 1
FormIsLoaded = UserForms(UF).Name = UFName
If FormIsLoaded Then Exit Function
Next UF
End Function

Sub Test()
'Load UserForm1
MsgBox FormIsLoaded("UserForm1"), 64
'If FormIsLoaded("UserForm1") Then Unload UserForm1
End Sub

Regards,
MP

"Jos Vens" a écrit dans le message de
...
Hi,

is it possible to check if a specific form is loaded into memory?

Thanks,
Jos Vens







All times are GMT +1. The time now is 07:12 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com