none
Can I have my Custom tab always appearing as the cefault tab for any calendar? RRS feed

  • Question

  • I have a custom ribbon tab that mainly concerns calendars. When I switch to a calendar the calendar Home tab is activated. Is there a way to activate mine instead.

    Thanks.


    Mike VE

    Monday, May 14, 2018 4:43 PM

Answers

  • Sorry for the delay in replying. Thanks for the suggestions, guys.

    I am using Add-in Express and it turns out to possible by setting the BeforeIdMso property of the custom tab to TabCalendar.


    Mike VE

    • Marked as answer by Mike VE Friday, May 18, 2018 10:34 AM
    Friday, May 18, 2018 10:33 AM

All replies

  • Not using the Outlook Object Model. You can either use the Accessibility API or Redemption.

    Using Redemption and its SafeExplorer object:

    set sInspector = CreateObject("Redemption.SafeExplorer")
    sInspector.Item = Application.ActiveExplorer
    set Ribbon =  sInspector.Ribbon
    Ribbon.ActiveTab = "View"


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Monday, May 14, 2018 4:49 PM
  • Hello Mike,

    The Ribbon UI extensibility model provides the IRibbonUI.ActivateTab method which allows to activate the specified custom tab. This method returns S_FALSE if there is no Ribbon or the Ribbon is collapsed. For example, a VBA macro:

    Public myRibbon As IRibbonUI 
    
    Sub tabActivate(ByVal control As IRibbonControl) 
     myRibbon.ActivateTab (control.ID) 
    End Sub

    Also you may find the IRibbonUI.ActivateTabMso method helpful. It allows to activate the specified built-in tab.

    You can read more about the Fluent UI (aka Ribbon UI) in the following series of articles:

    Customizing the 2007 Office Fluent Ribbon for Developers (Part 1 of 3)

    Customizing the 2007 Office Fluent Ribbon for Developers (Part 2 of 3)

    Customizing the 2007 Office Fluent Ribbon for Developers (Part 3 of 3)

    FYI In the add-in you may get an instance of the IRibbonUI interface from the onload callback. The onLoad callback is defined on the customUI node as follows:

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

    The signature for this callback in code receives an IRibbonUI object. Cache a copy of this object in a global variable to call these methods. The callback is called when the customization is loaded and only then. You cannot call it again. Because globals are reset when an unhandled error occurs, test the object for Nothing before calling the method. The following code shows you how to cache the object.

    Public gobjRibbon As IRibbonUI 
    Public Sub OnRibbonLoad(objRibbon As IRibbonUI) 
        Set gobjRibbon = objRibbon 
    End Sub 



    profile for Eugene Astafiev at Stack Overflow, Q&A for professional and enthusiast programmers

    Monday, May 14, 2018 6:12 PM
  • Interesting... What is wrong with ActivateTab and ActivateTabMso methods?

    profile for Eugene Astafiev at Stack Overflow, Q&A for professional and enthusiast programmers

    Monday, May 14, 2018 6:13 PM
  • Ah, yes, I forgot about IRibbonUI.

    But it only works in a COM addin - an external app cannot get that interface; it can only be retrieved from a ribbon callback. 


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Monday, May 14, 2018 6:16 PM
  • Well, a custom tab can be brought by the add-in only. So, we are speaking about the add-in.

    profile for Eugene Astafiev at Stack Overflow, Q&A for professional and enthusiast programmers

    Monday, May 14, 2018 6:30 PM
  • Hello Mike VE,

    As far as I know there is no setting option to make a tab default tab as you want. As a workaround, you could try to using ActivateTab function to activate your custom tab in ViewSwitch event. In the event, you could try to confirm if CurrentView is "Calendar" and then try to activate/not activate the tab.

    Best Regards,

    Terry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, May 15, 2018 5:45 AM
  • Sorry for the delay in replying. Thanks for the suggestions, guys.

    I am using Add-in Express and it turns out to possible by setting the BeforeIdMso property of the custom tab to TabCalendar.


    Mike VE

    • Marked as answer by Mike VE Friday, May 18, 2018 10:34 AM
    Friday, May 18, 2018 10:33 AM