Trindaz
Trindaz

Reputation: 17849

Add custom group to Home tab in Outlook 2010 using VBA

Can't seem to find any simple VBA tutorials for adding a custom group to the Home tab in the Outlook 2010 ribbon.

Shouldn't it be a couple of simple steps involving something like traversing objects in the Home tab and programmatically add the group with controls etc, or redefine the XML that describes the Home tab.

Is there any sample VBA code or articles that have this simple example? Specifically I'm trying to add a custom group with 1 text field and 1 button that fires a custom macro.

Cheers, Dave --Trindaz on Fedang #outlook-2010-vba

Upvotes: 2

Views: 6855

Answers (2)

Joe Almore
Joe Almore

Reputation: 4331

Another answer using Ribbon XML for Outlook 2010:

 <customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="Ribbon_Load">
  <ribbon>
    <tabs>
      <tab idMso="TabMail">
        <group id="Group0"  label="my Group" insertBeforeMso="GroupMoveActions">
          <button id="myButton"
              size="large"
              label="someLabel"
              screentip="A tip to read..."
              supertip="Some super tip..."
              />
        </group>
      </tab>
    </tabs>
  </ribbon>
</customUI>

You can also download this file: Office 2010 Help Files which contains the IDs of the Outlook controls. Once installed, look for the file OutlookExplorerControls.xlsx, this file contains the names of the groups you can use for the property insertBeforeMso.

Upvotes: 3

Trindaz
Trindaz

Reputation: 17849

I wasn't able to get any VBA working for this, but I was able to...

  1. Create a new Outlook 2007 project type in Visual Studio 2008
  2. Add a new Ribbon (XML) item to the project
  3. Follow the instructions in the sample code in the newly created Ribbon1.vb
  4. Make sure the <tab> element in Ribbon1.xml has property idMso="TabMail"
  5. Publish and run the installer application to get the new items appearing in the Home tab of the Outlook ribbon

Done!

Upvotes: 7

Related Questions