View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Does Userform exist?

Just for clarification, this code would be used within a workbook containing
the userform. It would not work as code housed external to the workbook
containing the useform.

Your explanation of what you want is somewhat ambiguous - this is Bob's
interpretation and mine was a differnt interpretation of what you want.


--
Regards,
Tom Ogilvy

"Bob Phillips" wrote in message
...
Hi Andy,

This demonstrates it

Dim oUserForm As Object
On Error Resume Next
Set oUserForm = UserForms.Add("Some form name")
On Error GoTo 0
If oUserForm Is Nothing Then
MsgBox "The Userform was not found.", vbExclamation, "Load

userforn
by name"
End If


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Andy" wrote in message
...
Hi All

I have a macro that makes use of a UserForm for gathering data from the
user. While the userform should always exist on the users' machines

this
might not always be the case. Is anybody aware of a way of checking to

see
if a UserForm exists in the Personal.xls workbook so I can handle such
instances? If it doesn't then there is obviously a compile error so I

have
had a look at the #const and #if... directives but can't figure it out.

Thanks

Andy