Excel Workbook Node

Applies to

The information in this topic applies only to the specified Visual Studio Tools for Office projects and versions of Microsoft Office.

Project type

  • Document-level projects

Microsoft Office version

  • Excel 2007

  • Excel 2003

For more information, see Features Available by Application and Project Type.

The Microsoft Office Excel workbook node in Solution Explorer does not have a code file or a design surface. The Excel workbook node serves only as a container for the worksheet and workbook code files and designers.

If you right-click the Excel workbook node, you have the option to add a new worksheet or chart sheet to the workbook, or to rename the workbook. The worksheet and chart sheet are host items, which means that they have code files and they expose events that you can program against. For more information about these objects, see Worksheet Host Item and ChartSheet Host Item.

When you rename the workbook in Solution Explorer by using the shortcut menu, it renames the workbook in the project folder. If the solution is closed and you rename the workbook in the project folder by using Windows Explorer, Visual Studio will display the updated name the next time you open the solution. If the solution is open and you rename the workbook in the project folder by using Windows Explorer, the name change will not show up in Solution Explorer until you close and reopen the solution.

Workbook vs. ThisWorkbook

The workbook node is a container for the code files and design surfaces of the worksheet and workbook (.vb files for Visual Basic projects and .cs files for C# projects). You cannot program against the workbook node.

ThisWorkbook (ThisWorkbook.vb or ThisWorkbook.cs) represents the workbook that you can program against; it has a code file and a designer, and it exposes events. For more information, see Workbook Host Item.

See Also

Concepts

Office Documents in the Visual Studio Environment Overview

Document vs. Template Files