How to check for availability activeX control

  • Thread starter Emile van Mierlo
  • Start date
E

Emile van Mierlo

Hello Group,



When distributing Excel projects with non-standard activeX controls I need
to make sure that they're installed before calling the control.

For example, the calendar control is a nice control, but it can be missed if
not available. I would like to check if the calendar is available, and only
then call it.



Does anybody know if this can be checked with Excel VBA, and how?



Thanks a lot.



Emile van Mierlo
 
B

Bob Phillips

Can you not just set an object variable for the object, and test that it is
not Nothing.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
E

Emile van Mierlo

Can you not just set an object variable for the object, and test that it
is
not Nothing.

Yes I can. I was thinking of checking the registry for it, but this works
just as well. Thanks for suggesting Bob.



Public Function hasCalendar() As Boolean
Dim obj As Object

On Error Resume Next
Set obj = CreateObject("MSCAL.Calendar")

hasCalendar = Not obj Is Nothing
Set obj = Nothing

End Function

Emile
 
Top