Visual Studio Tools for Office Project Extensibility Overview
Visual Studio includes a programmable object model that exposes the Visual Basic and Visual C# projects and the project items they contain. This model contains several objects that may be used for automating tasks in the integrated development environment (IDE) and extending project types and project items. The object model is available simply by adding a reference to the VSLangProj.dll assembly to any project. For more information, see Introduction to Project Extensibility.
There are four areas in which you can automate Visual Studio Tools for Office projects:
Creating projects using the Visual Studio Tools for Office Project Wizard.
Executing commands in the Commands collection.
Editing project properties.
Editing file properties.
Creating Projects Using the Visual Studio Tools for Office Project Wizard
You can automate the Visual Studio Tools for Office Project Wizard to:
Create a project, including a new document, using default wizard settings.
Create a project, including a new document, with a custom name and location.
Create a project for an existing document with a custom path.
For more information, see Walkthrough: Creating a New Office Project Using Visual Studio Project Automation.
Executing Commands in the EnvDTE.Commands Collection
There are two commands in the Commands collection for Microsoft Office Excel. Microsoft Office Word does not expose any commands into the Commands collection. For more information, see Referencing Automation Assemblies and the DTE2 Object.
The two available commands are:
Add Excel Worksheet
Add Excel Chart
For more information, see How to: Add Worksheets to Workbooks Using Visual Studio Project Automation.
Editing File Properties
Use the Properties collection to get to the properties of the items in a project.
The ProjectItem properties are:
Document property:
- Namespace for Host Item (C# only)
Document, workbook, and sheet property:
- Display Name
For more information, see How to: Change Excel Properties Using Visual Studio Project Automation.
See Also
Tasks
Walkthrough: Creating a New Office Project Using Visual Studio Project Automation
How to: Add Worksheets to Workbooks Using Visual Studio Project Automation
How to: Change Excel Properties Using Visual Studio Project Automation
Concepts
Visual Basic and Visual C# Project Extensibility Examples