Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

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.

To reference a .NET Framework component

  1. In the Macros IDE, choose Add Reference on the Project menu. This displays the Add Reference dialog box.

  2. In the Add Reference dialog box, choose a component in the list and then choose Select.

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

  1. In a command prompt, run TLBIMP on the COM component you want to import.

    TipTip:

    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.

  2. Move the resulting .dll file to the Macros BIN directory: ...\Microsoft Visual Studio 9\Common7\IDE\PublicAssemblies.

  3. 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.

  4. 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.

Community Additions

ADD
Show:
© 2015 Microsoft