Developing for Office 2007

Ribbons, VSTO and VBA

This article was originally published on DNJ Online
DNJ Online
This article was originally published on DNJ Online
DNJ

Customising ribbons

Much of the user interface of these applications can be customised, and is indeed defined using XML. You can add your own tabs to the ribbon command, for example, that contain new controls made up of buttons, text boxes, check boxes, drop-down combo boxes and so forth, simply by editing the appropriate XML. You can then reference these from your Visual Studio code. This can be done at the document level, by referencing the appropriate XML Part within the Open XML file, or at the application level, in which case the functionality becomes part of the application.

You can also develop your own task panes. Introduced with Office XP, these appear down the right-hand side of the screen and offer additional functionality, typical examples being the Research pane or the Search pane. Office 2003 allowed you to create your own task panes, a feature that has been further enhanced for Office 2007.

Using Visual Studio Tools for Office (VSTO), task panes become programmable surfaces on which you can drop ActiveX controls, Windows Forms and so forth. These can make full use of the .NET Framework, so they could, for example, pull data from your customer database, or from a Web service.

Of VBA and VSTO

Programming the Office applications has traditionally been done using Visual Basic for Applications (VBA), However Office 2003 saw the introduction of Visual Studio Tools for Office (VSTO) 2003, a version of Visual Studio .NET that allowed you to add program code to Microsoft Word or Excel 2003 documents using either C# or Visual Basic .NET.

With the appearance of Visual Studio 2005, VSTO 2003 was replaced with the current version, namely VSTO 2005. This adds a visual designer that opens Excel and Word 2003 documents and templates as work surfaces directly within the Visual Studio environment. You can, for example, drag controls from the Visual Studio Toolbox directly onto the document. VSTO 2005 also adds the ability to create application-level add-ins for Outlook 2003, which appear as options on the Tools menu, and to add business logic to InfoPath 2003 forms.

There will be a new version of VSTO to accompany Office 2007. Codenamed ‘Cypress' or ‘v3', the Community Technology Preview is available now for download from the Microsoft Office Developer Center . This allows you to build application-level add-ins for PowerPoint and Visio 2007, as well as not only InfoPath and Outlook 2007 but also Word and Excel 2007 (these last apparently being one of the most requested features for VSTO). InfoPath support will include the ability to design InfoPath 2007 forms from within the Visual Studio environment.

Looking further ahead there will be a VSTO ‘Orcas' to accompany the next version of Visual Studio (also codenamed ‘Orcas'). This will include visual designers for both the new ribbon control and for custom task panes.

Nevertheless, there is still a place for VBA, and indeed all the Office 2007 desktop applications still come with the VBA development environment (now on version 6.4) built in – either as an option on the Tools menu or as a new Developer tab on the Ribbon control. By contrast VSTO is a stand-alone version of Visual Studio that needs to be licensed in its own right, either at the same cost as Visual Studio 2005 Professional Edition or as part of an MSDN Professional or Premium subscription.

You might also like...

Comments

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.”