UserForm

Nomis_Eswod

Board Regular
Joined
Jul 27, 2005
Messages
153
Hi,

Is there any generic names for UserForms? I have about 8 in my spreadsheet and I was hoping to do an IF UserForm.Name = "..." Then etc...
But I can't work out what the generic name would be.

Any ideas?
 

Some videos you may like

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
There is a UserForms collection which contains each loaded UserForm. You can iterate through it like any collection.
 

Nomis_Eswod

Board Regular
Joined
Jul 27, 2005
Messages
153
Ok....many thanks!

What about ways to disable the 'x' at the top of the userform that closes the form? Is there any way to do that, or work around, so that users can't use it?
 

BBHRVS

Board Regular
Joined
Nov 3, 2005
Messages
94
Hi;

Put this into the UF code module :
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode <> 1 Then Cancel = 1: MsgBox "please use the esc button to go out !"
End Sub
 

Watch MrExcel Video

Forum statistics

Threads
1,118,327
Messages
5,571,560
Members
412,405
Latest member
DutchMonkey
Top