ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to check for availability activeX control (https://www.excelbanter.com/excel-programming/297156-how-check-availability-activex-control.html)

Emile van Mierlo

How to check for availability activeX control
 
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




Bob Phillips[_6_]

How to check for availability activeX control
 
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)

"Emile van Mierlo" wrote in message
...
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






Emile van Mierlo

How to check for availability activeX control
 
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




All times are GMT +1. The time now is 08:54 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com