Closing open userforms

Guillaume -  
jc80 Posted messages 5063 Registration date   Status Member Last intervention   -
Hello,

I am getting back to you regarding another issue.

I would like to close all the open userforms so that only the welcome userform is displayed.

I tried the following:
Dim USF As Object
For each USF in userforms
If USF.name.visible = true then USF.name.hide
Next USF
UF_Acceuil.show

But I don't understand, at the If statement I am ejected from my "for each" loop.

Best regards,

Guillaume

Configuration: iPhone / Safari 9.0

2 answers

tyranausor Posted messages 3501 Registration date   Status Member Last intervention   2 060
 
Hello, I tested your code, it indeed doesn't work, I don't know why. By just putting
USF.visible
instead of
usf.name.visible
it works.

I assume Excel can't find your userforms because you renamed them differently than userform1, userform2, ...

--
Forum users are not clairvoyants, at least I'm not!
0
jc80 Posted messages 5063 Registration date   Status Member Last intervention   1 443
 
Hello

Below is a code for a button
1° property CmdClose
2° name Close

Private Sub CmdClose_Click()
Unload Me
End Sub
0