Udostępnij za pośrednictwem


How to: Create Visual Studio Tools for Office Projects

You can use Visual Studio Tools for Office to create the following types of projects for applications in the 2007 Microsoft Office system and Microsoft Office 2003:

For more information about these types of projects, see Office Solutions Development Overview.

Note

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 create an application-level add-in project

  1. On the File menu, point to New, and then click Project. If your IDE is set to use Visual Basic development settings, on the File menu, click New Project.

    The New Project dialog box appears.

  2. In the Project Types pane, under the node for the language you want to use, expand Office.

  3. Select the 2003 or 2007 folder, depending on which version of Microsoft Office you want the add-in to work with.

  4. In the Templates pane, select an add-in project.

    Add-in project names have the structure Application VersionAdd-in. Application is the name of the Microsoft Office application that the add-in will work with, and Version indicates the version of Office: 2003 or 2007. For a list of the add-in project templates you can use, see Visual Studio Tools for Office Project Templates Overview.

    Note

    If project templates are not visible when you select the 2007 folder, select .NET Framework 3.5 in the Framework Version list. For more information, see How to: Target a Specific .NET Framework.

  5. In the Name box, type a name for the project. By default, this name is also used for the solution.

    Note

    For 2003 system add-ins, do not use Unicode characters in the project name if you want to use the default Setup project to deploy your add-in. Visual Studio Tools for Office projects support using Unicode characters in the project name, but Setup projects do not. By default, the name of the Setup project for add-ins includes the name of the add-in project. Also, if you plan to deploy the solution for use offline, the characters in the project name must fit the HTTP protocol specifications. For more information, see Offline Model for Office Solutions (2003 System).

  6. In the Location box, enter a location where you want to create the project. You can use absolute and UNC paths. Do not use HTTP, FTP, or other protocol paths to the project.

    Locations have the following formats:

    • [drive]:\

    • \\Server\Share

    Do not use these characters in the location:

    • Asterisk (*)

    • Vertical bar (|)

    • Colon (:) (except following the drive letter)

    • Double quotation mark (") (paths that contain spaces do not need quotation marks)

    • Less than (<)

    • Greater than (>)

    • Question mark (?)

    • Percent sign (%)

  7. Click OK.

    Note

    Add-in projects are always saved when they are created. They cannot be created as temporary projects. For more information about temporary projects, see Temporary Projects.

To create a document-level customization project

  1. On the File menu, point to New, and then click Project. If your IDE is set to use Visual Basic development settings, on the File menu, click New Project.

    The New Project dialog box appears.

  2. In the Project Types pane, under the node for the language you want to use, expand Office.

  3. Select the 2003 or 2007 folder, depending on which version of Microsoft Office Word or Microsoft Office Excel you want the customization to work with.

  4. In the Templates pane, select the document-level project you want to create.

    Document-level project names have the structure Application VersionDocumentType. Application is the name of the Microsoft Office application that the document-level project will work with. Version indicates the version of Microsoft Office: 2003 or 2007. DocumentType can be Workbook, Template, or Document. For a list of the document project templates you can use, see Visual Studio Tools for Office Project Templates Overview.

    Note

    If project templates are not visible when you select the 2007 folder, select .NET Framework 3.5 in the Framework Version list. For more information, see How to: Target a Specific .NET Framework.

  5. In the Name box, type a name for the project. By default, this name is also used for the document. If your IDE is set to use Visual C# development settings or General development settings, enter a location and solution name also.

    Note

    You cannot use surrogate characters in the path to the project location or in the project name. For information about surrogate characters, see Unicode Support for Surrogate Pairs and Combining Character Sequences. Also, if you plan to deploy the solution for use offline, the characters in the project name must fit the HTTP protocol specifications. For more information, see Offline Model for Office Solutions (2003 System).

  6. Click OK.

    The Visual Studio Tools for Office Project Wizard opens.

  7. Select Create a new document if you want to create a new document for the solution, or select Copy an existing document if you want to customize an existing document.

    If you create a new document, specify the name in the Name box. If you are creating a project for the 2007 Microsoft Office system, also choose the format of the document by using the Format box. For more information about the available formats, see Architecture of Document-Level Customizations.

    If you use an existing document, specify the location of the document in the Full path of the existing document box. You can use absolute and UNC paths. Do not use HTTP, FTP, or other protocol paths to the document.

    Locations have the following formats:

    • [drive]:\

    • \\Server\Share

    Do not use these characters in the location:

    • Asterisk (*)

    • Vertical bar (|)

    • Colon (:) (except following the drive letter)

    • Double quotation mark (") (paths that contain spaces do not need quotation marks)

    • Less than (<)

    • Greater than (>)

    • Question mark (?)

    • Percent sign (%)

  8. Click Finish.

  9. Add the project folder and its subfolders to the list of trusted locations in the Trust Center in Word if you are creating a Word 2007 Document or Word 2007 Template project that is based on a .doc or .docm file.

    If the document contains a VBA project or hosts Windows Forms controls, adding the project folder to the list of trusted locations will help ensure that the document works as expected at design time. For more information on how to add a document to the trusted locations, see the Microsoft Office Online Web site Create, remove, or change a trusted location for your files.

See Also

Tasks

How to: Build Office Solutions

Concepts

Visual Studio Tools for Office Project Templates Overview

Collaborative Development of Office Solutions

Creating Office Solutions in Visual Studio

Getting Started Programming Application-Level Add-Ins