Search code examples
vbams-wordribbon

Is there a way of showing a customUI tab in Word when the document is opened?


I have a custom ribbon tab in Word, created with the CustomUI editor, with a host of buttons that all work fine. I am trying to find out if I can set the focus of this custom tab when the Word document is opened. [Or when a new document is created.]

Currently, it just shows the Home tab by default. i have found ways of turning the custom tab on and off, but not to 'set focus' to it.

Any ideas?


Solution

  • I couldn't get the Sendkeys solution to work reliably enough. The Active Accessibility solution seems to work, but needs a bit more time than I have. I'll certainly review this method later.

    I did find that there is a way of displaying the custom tab if it is the first one in the tab list. I used these settings:

    <customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
    <ribbon startFromScratch="false"> 
    <tabs>
    <tab id="customTab" insertBeforeMso="TabHome" label="CustomTabName">
    

    Thanks for the alternatives. Much appreciated.