Getting the filename of an ActiveX class name
In some circumstances, you use the CreateObject function to create an object from an ActiveX class.
The CreateObject function receives the class name as argument, and creates the object for you.
In order to create the object, it loads and uses the right library or executable file that contains the interface for that object.
set objApplication = CreateObject("Word.Application")
When you run the above code, the CreateObject will use the winword.exe in order to interact with the objects of Microsoft Word.
The following code snippet shows how to reveal the filename that will be used for a specific ActiveX class.
It does it by reading the class definitions from the Registry.
Private Declare Function RegOpenKeyEx Lib "advapi32.dll" Alias "RegOpenKeyExA" _
(ByVal hKey As Long, ByVal lpSubKey As String, ByVal ulOptions As Long, ByVal samDesired As Long, phkResult As Long) As Long
Private Declare Function RegCloseKey Lib "advapi32.dll" _
(ByVal hKey As Long) As Long
Private Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" _
(ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, lpData As Any, lpcbData As Long) As Long