Eugene Starostin

Develop MS Office add-ins, smart tags, RTD servers on RO Chrome

In part one of the Add-in Express and RO Chrome series I explored the idea of Office application-level extensibility, highlighted the key features of Add-in Express and showed how to get started with Outlook COM add-ins on RemObjects Chrome and Add-in Express. In part two, I’ll dig deeper into the concepts that are crucial for Office development and will speak about security and deployment, RAD modules and visual designers.

The inside of your Office solution

By default, every Office solution (either COM add-in, RTD server, smart tag or UDF) based on Add-in Express includes two projects: the main project and a setup project. The first project is your extension itself, the second one you use to deploy the extension. Both projects include all necessary references and dependencies.

Add-in Express project

Security and deployment
Every solution based on Add-in Express templates is secure and deployable. Firstly, Add-in Express isolates your solution in its own AppDomain by a custom shim, the Add-in Express Loader, included in the setup project. The loader gives you the ability to update your add-in on the fly which makes deployment and redeployment very comfortable for your administrators. Secondly, the loader acts in accordance with the strict Office security model, so your Office add-ins run under the High Security setting.

RAD modules
Each of your solutions includes a special RAD module (AddinModule.pas in this example) which is the “heart” of your project. It is an analog of the Data Module in Borland Delphi that has its own visual designer. This module is a container for all Office-specific components and provides “access points” for handling Office objects. Thus, the RAD module is the place where your write your applied code.

In this example, the AddinModule class uses all necessary namespaces including AddinExpress.MSO. It is a descendant of ADXAddinModule and it implements several methods and properties (see the listing below; some insignificant code pieces are skipped).

namespace MyFirstOutlookAddin;




[GuidAttribute('6B9D2084-1414-4054-ADBD-26840BCE3DD6'), ProgId('MyFirstOutlookAddin.AddinModule')]
AddinModule = public class(AddinExpress.MSO.ADXAddinModule)

class procedure AddinRegister(t: System.Type);
class procedure AddinUnregister(t: System.Type);
method UninstallControls(); override;

property OutlookApp: outlook._Application read self.HostApplication as outlook._Application;


constructor AddinModule;

{$REGION Component Designer generated code}
/// Required by designer support - do not modify the following method
method AddinModule.InitializeComponent;
self.AddinName := 'MyFirstOutlookAddin';
self.SupportedApps := (AddinExpress.MSO.ADXOfficeHostApp.ohaOutlook);


The concept of designers
Open the Solution Explorer windows and click on AddinModule. You will see the Add-in Designer. As described above, it is a container for any components including Office-specific components delivered with Add-in Express. You can add any components from the Toolbox to the module, however Office-specific ones can be added only by the designer commands available by the right click of the mouse. You can add the following Office-specific components (see the picture below or right click on the Add-in Designer):

  • Command bar, adds a new or customizes any existing toolbars of any Office applications.
  • Outlook Explorer and Inspector command bar, used to create new or change any existing toolbars on the Outlook Explorer and Inspector windows.
  • Built-in control connector use it to intercept any ID-based control built in Office applications; for example, to handle the Save menu item in Word or the Send button in Outlook.
  • Keyboard shortcut , provides the application-level keyboard shortcut; e.g. pressing Ctrl-Alt-S in Excel or Ctrl-F in PowerPoint.
  • Outlook Bar shortcut manager , use it to create your own set of shortcuts on the Navigation Pane of Outlook.
  • Ribbon tab , allows creating a new or customizing an existing tab on the ribbon context.
  • Ribbon Quick Access Toolbar , enables you to create your own quick access toolbar.
  • Ribbon Office menu , this component provides you with customization for the Office Menu in Office 2007 applications.
  • Outlook forms manager , you add it to your project to customize Outlook views and forms using advanced Outlook regions.
  • Event helpers , these components are used to handle all important events of all Office applications such as Outlook NewMail, Word DocumentBeforeSave, Excel WorkbookBeforeOpen, etc.
  • The Host Configuration item is used to configure Office applications for a specified .NET Framework version.

Add-in Designer

Since AddinModule in this example is the central module of the project, it implements all COM-interfaces required by the COM Add-in technology and it has the base properties and events of COM add-ins (see the picture below). You can use the Properties window to name your add-in, to specify images for your toolbars and ribbon controls, to register your add-in for the current user or for all users, to collect and register your custom task panes and custom Outlook property pages, to define the namespace for your ribbon customization. Finally, using the SupportedApps property of your AddinModule you can enable / disable your extensions for certain Office applications. The events of your AddinModule include the common Office events for add-in initialization, finalization, error trapping, ribbon loading and task pane creation (see the picture below).

Add-in Module properties

Add-in Module events

That’s all for now. In part three of the series, we will look more closely at the Office customization, namely creating your own toolbars for traditional Office 2000 – 2007 UI, customizing Office 2007 Ribbon UI and adding application-level keyboard shortcuts.

Related posts:

Create Microsoft Office extensions using RemObjects Chrome
Customize Office toolbars, ribbons, task panes on RO Chrome

Post a comment

Have any questions? Ask us right now!