Andrei Smolin

Outlook and Word Toolbars mixed: problem and solution

Have you ever run into the issue when an Outlook toolbar created by your add-in shows up in Word? Or maybe, a Word toolbar gets displayed in Outlook? This article describes the issue and provides a workaround; the source code is supplied in VB.NET, C# and Delphi.

Add-in description: An Outlook add-in showing a custom command bar in the Outlook Inspector window. Or, a Word add-in showing a custom command bar.

Host Applications:

  • Outlook 2000, 2002, 2003
  • Word 2000, 2002, 2003

Problem description: When Word is used as the default email editor, custom Outlook Inspector command bars get shown in Word. Similarly, a custom Word commandbar shows up in the Outlook Inspector window.

Side issues: A commandbar popup shown on the Outlook commandbar displays no controls (empty popup).

Workaround: To bypass this, the add-in must support both Word and Outlook. When loaded in Word, the add-in hides the Outlook commandbar; when loaded in Outlook inspector, it hides the Word commandbar. As a rule, command bars must be created as temporary in Outlook and permanent in Word. However, if Word is the default email editor, the add-in must create the Outlook inspector toolbar as permanent; this prevents the popup from getting empty. Doing this creates the necessity to run Word in order to remove the toolbar when the add-in is uninstalled. Because it is impossible to run the application for an arbitrary user account on the given PC, you cannot remove the permanent Word toolbar for all user accounts on the PC. That is, the resulting add-in can be installed on the per-user basis only.

Available downloads:

C# sample for Visual Studio 2005
VB.NET sample for Visual Studio 2005
Sample for Delphi 7

2 Comments

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

    Andrei,

    if I interpret the sample code correctly, unregistration will only work properly when performed from the same user account that was previously using the addin in Word/Outlook, correct? In the common scenario where installation/uninstallation is performed from a dedicated administrator account users will be left with orphaned commandbar controls in Word.
    Or am I missing something here?

    P.S.: And no, I am not aware of a solution to this problem either – short of creating a standalone cleanup-utility that users have to run after uninstallation.

    Cheers,

    Oliver

  • https://secure.gravatar.com/avatar/29957f26ad2d8ba527fd9cc8cfa7b2e0?s=32&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D32&r=G Andrei Smolin (Add-in Express Team) says:

    Hello Oliver,

    Yes, uninstalling a per-machine add-in showing a custom toolbar removes the toolbar only for the user that runs the uninstaller; all other user accounts are not accessible. That is one of the reasons why we recommend using per-user add-ins if yoou need to show a custom toolbar in Word, see Deploying Word add-ins.

Post a comment

Have any questions? Ask us right now!