Is there a way to test if a control exists on a userform?
Why not pass the control to the ClearForm macro?
--
HTH
Bob
"Ryan H" wrote in message
...
I have a sub (ClearUserform) that is called by several userforms.
Sometimes
the control may not be on the userform passed to ClearUserform, thus I get
an
error. So I added the On Error Resume Next statement to quickly work
around
the error. Is there a way to test if the control exists on the userform
passed to the sub.
Sub MySub()
Call ClearUserform(Userform1)
End Sub
Sub ClearUserform(MyForm As UserForm)
On Error Resume Next
MyForm.TextBox1 = ""
' i have other controls list here
On Error GoTo 0
End Sub
--
Cheers,
Ryan
|