This documentation is archived and is not being maintained.

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.

Reference a .NET Component

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.

Reference a COM Component

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 8\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.

    NoteTip

    TLBIMP is a command line command located in ...\Microsoft Visual Studio 8\SDK\v2.0\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 8\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.

See Also

Show: