Export (0) Print
Expand All

Referencing COM and .NET Framework Components in Macros

Visual Studio .NET 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 .NET macros to reference it.

To reference a .NET Framework component

  1. In the Macros IDE, choose Add Reference on the Project menu. Alternatively, you can right-click the References node under the macro project node in Project Explorer and choose Add Reference. 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 .NET\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.
    Tip   TLBIMP is a command line command located in ...\Microsoft Visual Studio .NET\FrameworkSDK\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 TMLIMP command options.

  2. Move the resulting .dll file to the Macros BIN directory: ...\Microsoft Visual Studio .NET\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

Automating Repetitive Actions by Using Macros | Recording Macros | Running Macros | Editing Macros | Debugging Macros | Macro Recording and Running Issues | Managing Macros | Macros and the EnvironmentEvents Project Item | Macros Security and Sharing Issues

Show:
© 2015 Microsoft