John Grabau

Hi,

I am searching for a way to access a MS Word 2007 RibbonTab. I have devloped an VSTO AddIn and everything is fine.

But when I open a new Doc with my AddIn, the new Doc is shown and the first RibbonTab is activated.

Now I want to activate my AddIn-RibbonTab

Thank you!

Regards John



Re: Visual Studio Tools for Office Access a Ribbon with VSTO

Ji Zhou – MSFT

Hi John,

The first Tab always appears in UI when the word loads. I am not aware of a way that could modify the default option.

But you can insert the Tab before the Home Tab. This way, your tab will be the first one and loaded as default.

The ribbon customization xml file should look like:

Code Block

<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" onLoad="OnLoad">

<ribbon>

<tabs>

<tab id="TabAddIns" insertBeforeMso="TabHome" label="AddIns">

<group id="MyGroup"

label="My Group">

<toggleButton id="toggleButton1"

size="large"

label="My Button"

screentip="My Button Screentip"

onAction="OnToggleButton1"

imageMso="HappyFace" />

</group>

</tab>

</tabs>

</ribbon>

</customUI>

Hope it helps!

Thanks

Ji






Re: Visual Studio Tools for Office Access a Ribbon with VSTO

Cindy Meister

Hi John

as a supplement to Ji's answer, the only way you can programmatically show a Tab is to send the keyboard shortcut (Alt + the key accelerator) using SendKeys. This isn't 100% guaranteed to work, as the key accelerators could change (interfere with one another), but it's a possibility in a "limited environment".

You can assign a key accelerator to your tab using the keytip attribute.






Re: Visual Studio Tools for Office Access a Ribbon with VSTO

John Grabau

Hi Cindy,

thank you for this tip... but I have two more questions:

1. I tried to set the "keytip"-Attribute in the Ribbon.xml (<tab id="Actosoft" label="&amp;Actosoft" keytip="a">), but it didn't work. The shown keytip is still "Y2". What is my mistake

2. Can you show me an example using SendKeys I tried it out, but the only thing happened was painting "Y2" in my document.

Thanks a lot!

John





Re: Visual Studio Tools for Office Access a Ribbon with VSTO

Cindy Meister

1. Start your Office application without your Ribbon. Press the Alt key. Do you see "A" used anywhere If a letter is used more than once, you get the "Y2" kind of reaction. That's why I mentioned the approach isn't 100% reliable. If your Ribbon loads with anyone else's, and they just happened to use the same letter, then chances are neither keytip will function "as planned".

2. Here's the SendKeys to access the "Home" tab. Keep in mind that these built-in keytips are also language specific.

SendKeys "%H"