Office Project Templates Overview
The Microsoft Office developer tools in Visual Studio include project templates for creating the following types of Office solutions:
For a detailed comparison of these types of Office solutions, see Office Solutions Development Overview (VSTO).
The Office project templates are available in the New Project dialog box, under the Office node of the Visual C# and Visual Basic language nodes. Each template generates a project with the appropriate configuration for the target application, including assembly references and debugging settings.
Each project provides files and code to get you started on a specific kind of solution. The generated code for each project includes startup and shutdown event handlers. You can add code to these event handlers to initialize your solution when it is loaded and to clean up your solution when it is unloaded. For more information, see Office Projects in the Visual Studio Environment and Events in Office Projects.
The Office development tools are included with certain editions of Visual Studio. For more information, see Configuring a Computer to Develop Office Solutions.
The Office node in the New Project dialog box provides the following project templates to get you started creating document-level customizations for Word and Excel:
Word 2013 and 2016 VSTO Document
Word 2013 and 2016 VSTO Template
Excel 2013 and 2016 VSTO Workbook
Excel 2013 and 2016 VSTO Template
Word 2010 VSTO Document
Word 2010 VSTO Template
Excel 2010 VSTO Workbook
Excel 2010 VSTO Template
The Word Document and Excel Workbook project templates provide code to get you started creating a solution that is based on a specific document or workbook. In these types of solutions, your code runs only when the associated document is open in Word or Excel.
The Word Template and Excel Template project templates behave identically to the Word Document and Excel Workbook project templates. However, the Word Template and Excel Template project templates makes it easy for users to create new local document or workbook copies of the customized template in your solution. The features in your solution are available from the new document that the user creates from the template.
Word templates that reference managed code extensions cannot be used as global VSTO Add-ins. The assembly is not called if the template is loaded from the Startup directory of Word. For more information, see Limitations of Global Templates and Excel Add-ins (.xla Files)
For information about getting started with these project types, see the following topics:
The Office/SharePoint node in the New Project dialog box provides the following project templates to get you started creating VSTO Add-ins.
Excel 2013 and 2016 VSTO Add-in
InfoPath 2013 VSTO Add-in
Outlook 2013 and 2016 VSTO Add-in
PowerPoint 2013 and 2016 Add-in
Project 2013 and 2016 Add-in
Visio 2013 and 2016 Add-in
Word 2013 and 2016 Add-in
Excel 2010 Add-in
InfoPath 2010 Add-in
Outlook 2010 Add-in
PowerPoint 2010 Add-in
Project 2010 Add-in
Visio 2010 Add-in
Word 2010 Add-in
When you create a project that is based on one of these project templates, the code in your solution runs when the associated application is open. Unlike document-level projects, your code is not associated with a single document.
For more information about getting started with these project types, see the following topics:
When you design a solution around a Word document or Excel workbook, you must decide the best way to make that document available to your users.
Applies to: The information in this topic applies to document-level projects for Excel and Word. For more information, see Features Available by Office Application and Project Type.
In some situations, you might want to give a copy of a document to each user. In this case, create your solution by using an Excel or Word document project.
In other situations you might want to make a template available on a server, so that each user can open the template and save a local copy as a document. In this case, create your solution by using an Excel or Word template project.
The following table outlines the differences between documents and templates.
Users can open and modify a document, unless it is set to be read-only. Any saved changes are kept in the original.
Users can open a template to create a local copy as a new document. They cannot modify the original unless they are given special permissions.
When opened, the document raises the Open event.
When opened, the template raises the New event.
Documents, workbooks, and templates might not work correctly as global templates or Excel VSTO Add-ins (.xla files).
If a Microsoft Office Word template has managed code extensions, the project assembly is not called if the template is attached as a global template or loaded from the startup directory of Word. In addition, the document does not recognize the format of a template that is part of an Office solution.
There is no Office project for creating an Excel VSTO Add-in (.xla file). It is possible to save a workbook as an .xla file, but it is not a supported operation and is not recommended. If you save a workbook that has managed code extensions as a Microsoft Office Excel Add-In (*.xla) file, you can select it in the Add-Ins dialog box to apply to another workbook. In some cases your code will run in the target workbook after the VSTO Add-in is applied, but such use of the Office solution is not supported.