Search notes:

COM: Type library

A type library is a machine readable container that describes COM objects. Information stored in a type library includes, for exmample, method and parameter names.
The content of a type library can be viewed in the VBA Object Browser.
A type library file is typically identified by a .tlb, .olb or .ocx file extensions, but its data is occasionally also found in EXEs, DDLs and even binary files.

Creating type libraries

Type libraries can be created with the MIDL compiler (midl.exe). The MIDL compiler obsoletes the MkTypLib command line tool.
Thus, a type library is basically a binary version of a (humanly readable) MIDL file.

Registry

Type libraries can be registered in the registry under the key HKEY_CLASSES_ROOT\TypeLib.
Thus, it is possible to find the file locations of type libraries on a system.

Using type libraries in VBA Projects

In a VBA project, a type library that is added to the project, is identified by a Reference object.
A new reference to a type library can be added with ….references.addFromGUID(…).

Reading type libraries

The content of type libraries can be read with the ITypeLib interface.
An instance of such an interface can be obtained using the WinAPI function LoadTypeLib

See also

The function addReference() in the VBScript MS-Office App Creator tool.
oleview.exe is a type library viewer.
TlbImp.exe is the Type Library Importer and allows to create .NET assembly from a type library.
vstblinf.dll
RegAsm.exe
System.Runtime.InteropServices.ComImportAttribute

Index