How to: Reference COM and .NET Framework Components in Macros
Visual Studio macros can reference only .NET Framework components. To reference COM components, you must first import them using a tool called TLBIMP. TLBIMP "wraps" the component, enabling Visual Studio macros to reference it.
The list of components in the Add Reference dialog box includes all components installed by the .NET Framework, plus all private modules that you place in the ...\Microsoft Visual Studio 9\Common7\IDE\PublicAssemblies directory.
To import a COM component and then reference it in the Macros IDE
In a command prompt, run TLBIMP on the COM component you want to import.
TLBIMP is a command line command located in ...\Program Files\Microsoft SDKs\Windows\v6.0A\Bin. To use it, you must run it in a DOS prompt window, specifying the complete path of the COM component you want to import. For details on TLBIMP and how to use it to import a COM type library, see Type Library Importer (Tlbimp.exe).
This tool creates a .dll file. The name of the file can be determined using the TLBIMP command options.
Move the resulting .dll file to the Macros BIN directory: ...\Microsoft Visual Studio 9\Common7\IDE\PublicAssemblies.
Add a reference to the new component. In the Macros IDE, choose Add Reference on the Project menu to display the Add Reference dialog box. Alternatively, you can right-click the References node under the macro project node in Project Explorer and choose Add Reference.
Select the newly-imported .dll in the list under the .NET tab.
The reference now appears in the macro's References node in Macro Explorer.