Excel in the NET World

We can't code directly in the Excel 2007 VBE to use .NET components, but we can download tools from Microsoft that will let us create Excel projects from within Visual Studio 2005. VSTO and VSTO SE each come with a suite of tools that allow us to access various functions within an Excel project.

VSTO, which interfaces with Office 2003 applications, allows direct access to an Excel workbook and gives us programmatic control within the managed code environment. VSTO project templates include the ability to create the following:

• Excel workbook projects

Excel template projects

• Word template projects

• Word document projects

• Outlook add-in projects

Figure 9-4 shows the Visual Studio 2005 New Project dialog box for Microsoft Office 2003 projects from the original version of VSTO.

Project types: Templates:

□•• Visual Basic

Visual Studio installed templates

I - Windows

Office i Database L- Starter Kits El- Other Languages El- Other Project Types

^ ^ Jp

Excel Word Word Outlook Add-in Workbook Document Template

My Templates

Search Online Templates...

| A project for creating managed code extensions behind a new or existing Excel 2003 template.

Name: | ExcelTemplatel

OK | Cancel

Name: | ExcelTemplatel

OK | Cancel

Figure 9-4. VSTO Microsoft Office projects

VSTO SE adds some new project types to the toolbox, as shown in Figure 9-5.

Figure 9-5. New project types included in VSTO SE

VSTO SE provides us with two new project categories, Excel 2003 Add-ins and Excel 2007 Add-ins. It adds an InfoPath template project to the Office menu, as shown in Figure 9-6 (which shows the Windows Vista interface).

Figure 9-6. InfoPath Form Template project added in VSTO SE

Note If you already have VSTO installed, you can safely add VSTO SE. The existing Office 2003 project types will still be available. The new project types of VSTO SE will be available in addition to the original project types.

Figure 9-7 shows the VSTO SE Office 2003 Add-in projects available in the New Project dialog box.

Figure 9-7. Office 2003 Add-in projects added in VSTO SE in Windows XP

Another new project category containing Office 2007 Add-in projects is also added. The new selections are shown in Figure 9-8.

Figure 9-8. Office 2007Add-in projects added in VSTO SE in Windows Vista

VSTO is no longer available, but if you have a copy, you can still write code for Excel 2003 that will run in Excel 2007 Compatibility mode. VSTO SE provides add-in programming only.

Note VSTO SE is available as a free download from Microsoft at www.microsoft.com/downloads/ details.aspx?familyid=5E86CAB3-6FD6-4955-B979-E1676DB6B3CB&displaylang=en (if this link fails to work in the future, you can search the Web for "VSTO SE").

0 0

Post a comment