|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. ArchiveDisclaimer|
How to: Target Office Applications Through Primary Interop Assemblies
When you create a new Visual Studio Tools for Office project, Visual Studio automatically adds references to the Microsoft Office primary interop assemblies (PIAs) that are required to build your project. You must add references to other primary interop assemblies in the following scenarios:
You want to use features of other Microsoft Office applications in your project. For example, you might want to use features of Microsoft Office Excel in a project for Microsoft Office Word.
You want to automate Microsoft Office applications that do not have dedicated projects in Visual Studio Tools for Office, such as Microsoft Office Access.
For more information about the Microsoft Office applications that are supported by Visual Studio Tools for Office, see Features Available by Application and Project Type.
Your computer might show different names or locations for some of the Visual Studio user interface elements in the following instructions. The Visual Studio edition that you have and the settings that you use determine these elements. For more information, see Visual Studio Settings.
To add a reference to a primary interop assembly
Open your Visual Studio Tools for Office project and select the project name in Solution Explorer.
On the Project menu, click Add Reference.
On the .NET tab, select the primary interop assembly you want in the Component Name list. For more information about the available Microsoft Office primary interop assemblies, see Office Primary Interop Assemblies.
The assembly name appears in the References folder of Solution Explorer.