Easiest way is probably to try to reference it and catch the error, perhaps ..
Code:
Function UserFormExists(UserFormName As String) As Boolean
On Error Resume Next
temp = ActiveWorkbook.VBProject.VBComponents(UserFormName).Type
UserFormExists = temp = vbext_ct_MSForm
End Function
You will need a reference to Microsoft VBA Extensibility for the constant (or use its value (3)).
Enjoy,
Tony
-------------------------------------------------------------------------------------------- We want to help you; help us to do it by reading this: Before you ask a question.
Excel VBA Training and more Help at VBAExpress[
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.