Pieter van der Westhuizen

100% version neutrality for your Office extensions

One of the most important features of Add-in Express is version neutrality. It is also one of the features that do not immediately get noticed as Add-in Express hides the complexity so well with their COM Add-in project wizard.

When creating a new Add-in Express COM Add-in project in Visual Studio 2005, 2008 or 2010 – be it either the Express or Team System editions – you will be presented with a wizard prompting you to select your programming language of choice, the following languages are supported:

  • Visual C#
  • Visual Basic
  • Visual C++
  • Visual J#
  • Delphi Prism

You can also select the minimum support Office version that will be supported by your add-in. Versions of Microsoft Office that are supported:

  • Microsoft Office 2000
  • Microsoft Office XP
  • Microsoft Office 2003
  • Microsoft Office 2007
  • Microsoft Office 2010

Next, you can select all the Microsoft Office applications that will be supported by the add-in; the list of supported applications are:

  • Microsoft Excel
  • Microsoft Word
  • Microsoft Outlook
  • Microsoft PowerPoint
  • Microsoft Access
  • Microsoft InfoPath
  • Microsoft Visio
  • Microsoft Publisher
  • Microsoft MapPoint
  • Microsoft Project
  • Microsoft FrontPage

Add-in Express is compatible with both 32- and 64-bit version of Microsoft Office 2010 as well as all editions of Office including Professional, Home, Student and Standard:

Supported applications and programming languages

When the New COM Add-in project wizard is completed, it automatically generates code which makes it easy for the developer to access the different MS Office application objects by adding properties to the code as illustrated below:

public Excel._Application ExcelApp
        {
            get
            {
                return (HostApplication as Excel._Application);
            }
        }
        public Word._Application WordApp
        {
            get
            {
                return (HostApplication as Word._Application);
            }
        }
        public Outlook._Application OutlookApp
        {
            get
            {
                return (HostApplication as Outlook._Application);
            }
        }

Adding MS Office version specific UI elements are incredibly easy with the visual designers provided by Add-in Express. The Ribbon UI was added in Microsoft Office 2007 and is also used in Office 2010. To add your own elements to an Offce RibbonTab, add an ADXRibbonTab component by clicking its button on the AddinModule Designer surface.

Adding the ADXRibbonTab component

Using the built-in designer you can design the ribbon tab to look like the image below.

Designing a ribbon tab

By setting the Ribbons property of each Ribbon Group, you can specify on which ribbons the buttons should be shown. In this scenario, I’ve set the Ribbons property to OutlookMailRead, WordDocument and ExcelWorkbook respectively.

When you build and register your project. The above ribbon will be visible in Microsoft Office 2007/2010 Outlook, Word and Excel. It will however not be visible in any version lower than 2007.

To create UI elements for Office 2003 and earlier, is also as easy as using the build in Add-in Express visual designers. To add a commandbar for Office 2003 and lower, click on its button.

Adding a commandbar for Office 2003 and lower

Change the commandbar’s design to resemble the below image:

Changing the commandbar's design

By setting the commandbar’s SupportedApps property to Excel;Word;Outlook the commandbar will only be visible in versions of Excel, Word and Outlook, prior to Office 2007.

Office 2010 brought with it a number of mayor enhancements and changes. Two of these that need to be kept in mind when designing version independent add-in, is the Backstage view and the Outlook Solutions module. As a developer, if you add these components to your project, bear in mind that it will only be visible when the user uses Office 2010, for all previous version you need to add and design different UI elements.

Finally, when you completed your add-in, there is no need to build separate setup programs for different versions of Office. Generating a setup program is as simple as right-clicking your project in the Visual Studio Solution Explorer and selecting Create Setup Project from the context menu.

Creating a Setup Project

You can feel secure in the knowledge that Add-in Express has taken care of all the problems for you.

Thank you for reading. Until next time, keep coding.

2 Comments

  • https://secure.gravatar.com/avatar/05c633855c813580c408b4136e671982?s=32&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D32&r=G Alex says:

    Hello Pieter,

    thank you for good explanation version neutrality. Quick question: how I can change minimum support Office version for the existing project. For example, when project was created, minimum version was set to MS Office 2000. How I can change it to MS Office 2007?

    Thank you in advance

  • https://secure.gravatar.com/avatar/e1a4c2b21a5186e0b27c1c601f418b76?s=32&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D32&r=G Pieter van der Westhuizen says:

    Hi Alex.

    Thank you for reading!
    To change the minimum supported version of your add-in from Office 2000 to 2007, first remove the following references from your project:

    Interop.Excel/Outlook/Word etc (Will depend on which Office app the add-in is for)
    Interop.Office.dll
    Interop.VBIDE.dll

    You then need to add references to the interop assemblies for Office 2007. Add-in Express ships with all the interop assemblies, on my pc the path to these assemblies is C:\Program Files (x86)\Add-in Express\Add-in Express for .NET\Redistributables\Interop Assemblies\Office 2007

    So to change an Excel add-in’s minimum supported version to Office 2007, add the following references to the project:

    Microsoft.Office.Interop.Excel.dll
    Microsoft.Vbe.Interop.dll
    Office.dll

    Godd luck!

Post a comment

Have any questions? Ask us right now!