Answer the question
In order to leave comments, you need to log in
How to check if controls that are used in UserForm (VBA) are installed?
It is necessary to add a pop-up calendar to the excel file to enter dates in the appropriate fields. I implemented this using a UserForm and a Calendar Control, since the Internet is full of examples. For example on planetaexcel.ru .
But, as it turned out, this control is not present on every computer. And if it is not there, then VBA generates an error message for almost every action (which is also a little strange, but the question is different). It is planned that the file will be used on different computers under different versions of windows (XP and higher) and office (2003 and higher).
Is it possible to somehow check the presence of the installed "Calendar" control using VBA, and if it is not there, do not even try to initiate the form with the calendar? In other words, behave as if this functionality simply does not exist.
Answer the question
In order to leave comments, you need to log in
The easiest way, in my opinion, is to find out where the component is located and how it is named.
For example c:\windows\system32\calendar.ocx
And then using this or a similar function to find out if it is there
Function FileExist(filename As String) As Boolean
On Error Resume Next
FileExist = Dir$(filename) <> ""
If Err.Number <> 0 Then FileExist = False
On Error GoTo 0
End Function
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question