Is there a way to activate a certain Tab on the Ribbon?

I have a Word 2007 application level add-in that creates a custom tab on the ribbon ("MyTab").

I would like to write code in the DocumentOpen to force "MyTab" to be the current active tab when certain documents are in use.

Is there a callback that will allow me to force a particular ribbon tab to be selected



Answer this question

Is there a way to activate a certain Tab on the Ribbon?

  • Andrew-L

    Same question for me. I have a program in VBA that manage some particular documents, and my special Tab offerts some functions designed for this kind of documents. Therfore, my special Tab should be activated each time a new document of this kind is opened for consultation. So, why Microsoft Team did it so difficult to activate tabs

    For the moment, I use the vba function "SendKeys", but it is not very clean, et it does not always work :
    assuming that the keytip for my special tab is "JB", then I created this code in my vba program :

    Sub ActivateMyTab()
    ' Activate Word application to be sure keys will be send to the right application
    Application.Activate
    ' Be sure that the application is ready to receive my keys
    DoEvents
    ' Send 'Alt' key alone :
    SendKeys "%", True
    ' Then send the keytip :
    SendKeys "JB{ENTER}", True
    End sub

  • dxpsteve

    Unfortunately, the new ribbon model does not support the ability to programmatically set any control (control, group or tab) to be the active control. This is part of the design of the ribbon.

    The main idea behind this aspect of the design is that the user should never be "surprised" by changes in the UI. They should always be in control of the ribbon, as far as possible, with the exception of certain built-in behaviors of the app itself. Add-ins are not allowed to take part in this behavior. In this way, the user always has a consistent experience when working with the ribbon UI.


  • jitendra badkas

    I would like to know this aswell. Got a button in my ribbon to open a template, and when the template opens, Word changes to the "home" tab. Would like to change back to my custom tab, but can't figure out how.
  • Is there a way to activate a certain Tab on the Ribbon?