Page 1 of 2 12 LastLast
Results 1 to 10 of 17

Thread: Activate Ribbon Tab In Excel 2007 2010 *

  1. #1
    Administrator Excel Fox's Avatar
    Join Date
    Mar 2011
    Posts
    1,402
    Rep Power
    10

    Activate Ribbon Tab In Excel 2007 2010 *

    One can access the Ribbon by using Commandbars("Ribbon") that will return an IAccessible object. You can access the tabs using the oleacc.dll library which can return an array of other IAccessible objects which are basically the list of all child elements. So the first child of the ribbon would be its tab. Using the IDs (which are strings) of these children objects you can filter in to the next child level which can be menu items etc.

    Credit to Tony Jollans, Microsoft Word MVP for the ribbon demo that you can find at www.WordArticles.com

    Here you can download a working example of how to activate a tab in either 2007 or 2010 versions of Excel. Note, for Excel 2010, MS has already incorporated the ActivateTab and ActivateTabMso methods, so one doesn't have to worry about elaborate codes to get the job done. The XML code used is given below

    PHP Code:
    <customUI onLoad="OLUIR" xmlns=http://schemas.microsoft.com/office/2006/01/customui>
    <ribbon
    <
    tabs>
    <
    tab id="tabAUniqueNameIDForMyNewTab" label="My New Tab" insertAfterMso="TabView">
    </
    tab>
    </
    tabs
    </
    ribbon
    </
    customUI
    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
    https://eileenslounge.com/viewtopic.php?p=316254#p316254
    https://eileenslounge.com/viewtopic.php?p=316280#p316280
    https://eileenslounge.com/viewtopic.php?p=315915#p315915
    https://eileenslounge.com/viewtopic.php?p=315512#p315512
    https://eileenslounge.com/viewtopic.php?p=315744#p315744
    https://www.eileenslounge.com/viewtopic.php?p=315512#p315512
    https://eileenslounge.com/viewtopic.php?p=315680#p315680
    https://eileenslounge.com/viewtopic.php?p=315743#p315743
    https://www.eileenslounge.com/viewtopic.php?p=315326#p315326
    https://www.eileenslounge.com/viewtopic.php?f=30&t=40752
    https://eileenslounge.com/viewtopic.php?p=314950#p314950
    https://www.eileenslounge.com/viewtopic.php?p=314940#p314940
    https://www.eileenslounge.com/viewtopic.php?p=314926#p314926
    https://www.eileenslounge.com/viewtopic.php?p=314920#p314920
    https://www.eileenslounge.com/viewtopic.php?f=30&t=40533&p=314837#p314837
    https://www.eileenslounge.com/viewtopic.php?f=21&t=40701&p=314836#p314836
    https://www.eileenslounge.com/viewtopic.php?f=27&t=40621&p=314621#p314621
    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
    Attached Files Attached Files
    Last edited by DocAElstein; 04-16-2024 at 01:00 PM.
    A dream is not something you see when you are asleep, but something you strive for when you are awake.

    It's usually a bad idea to say that something can't be done.

    The difference between dream and aim, is that one requires soundless sleep to see and the other requires sleepless efforts to achieve

    Join us at Facebook

  2. #2
    Junior Member
    Join Date
    Jan 2012
    Posts
    9
    Rep Power
    0

    I can't seem to make this work with the "Add-In" tab

    I was able to make this work on all the tabs except for the "Add-Ins" and this is the one I'm wanting to display. Is there something I have to do special for the "-" in 'Add-Ins'?

    Also I saw you mentioned 2010 had some built in functionality....If I am using 2010 then do I not need all of your code?

    Thanks.

    Phil

    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
    https://www.youtube.com/watch?v=jTmVtPHtiTg&lc=Ugy_RiNN_kAqUvZ8W994AaABAg
    https://www.youtube.com/watch?v=QjEWAJ3d-jw&lc=UgxJLVpwY8fIla7G-pN4AaABAg.9BLeCWVhxdG9wgNsaS3Lp1
    https://www.youtube.com/watch?v=QjEWAJ3d-jw&lc=UgxJLVpwY8fIla7G-pN4AaABAg.9BLeCWVhxdG9wgR1EPUkhw
    https://www.youtube.com/watch?v=QjEWAJ3d-jw&lc=UgxJLVpwY8fIla7G-pN4AaABAg.9BLeCWVhxdG9wgNe_XC-jK
    https://www.youtube.com/watch?v=QjEWAJ3d-jw&lc=UgxJLVpwY8fIla7G-pN4AaABAg.9BLeCWVhxdG9wgNPOdiDuv
    https://www.youtube.com/watch?v=QjEWAJ3d-jw&lc=UgxJLVpwY8fIla7G-pN4AaABAg.9BLeCWVhxdG9wgN7AC7wAc
    https://www.youtube.com/watch?v=bs-urI_o8jo&lc=UgyBACXgNY4j_cHgH5J4AaABAg.9oTkVdzfqfm 9wlhQrYJP3M
    https://www.youtube.com/watch?v=bs-urI_o8jo&lc=UgxYgiEZuS9I3xkjJv54AaABAg
    https://www.youtube.com/watch?v=DVFFApHzYVk&lc=Ugyi578yhj9zShmhuPl4AaABAg
    https://www.youtube.com/watch?v=GqzeFYWjTxI&lc=UgxvxlnuTRWiV6MUZB14AaABAg
    https://www.youtube.com/watch?v=_8i1fVEi5WY&lc=Ugz0ptwE5J-2CpX4Lzh4AaABAg
    https://www.youtube.com/watch?v=0ltJS7uHfK4&lc=UgxoHAw8RwR7VmyVBUt4AaABAg. 9C-br0lEl8V9xI0_6pCaR9
    https://www.youtube.com/watch?v=0ltJS7uHfK4&lc=Ugz5DDCMqmHLeEjUU8t4AaABAg. 9bl7m03Onql9xI-ar3Z0ME
    https://www.youtube.com/watch?v=0ltJS7uHfK4&lc=UgxYnpd9leriPmc8rPd4AaABAg. 9gdrYDocLIm9xI-2ZpVF-q
    https://www.youtube.com/watch?v=0ltJS7uHfK4&lc=UgyjoPLjNeIAOMVH_u94AaABAg. 9id_Q3FO8Lp9xHyeYSuv1I
    https://www.reddit.com/r/windowsxp/comments/pexq9q/comment/k81ybvj/?utm_source=reddit&utm_medium=web2x&context=3
    https://www.youtube.com/watch?v=bs-urI_o8jo&lc=UgxYgiEZuS9I3xkjJv54AaABAg
    https://www.youtube.com/watch?v=bs-urI_o8jo&lc=UgyBACXgNY4j_cHgH5J4AaABAg.9oTkVdzfqfm 9wlhQrYJP3M
    ttps://www.youtube.com/watch?v=LP9fz2DCMBE
    https://www.youtube.com/watch?v=LP9fz2DCMBE&lc=UgzbPgJUMCztIOQDym14AaABAg
    https://www.youtube.com/watch?v=LP9fz2DCMBE&lc=UgzbPgJUMCztIOQDym14AaABAg. 9wdo_rWgxSH9wdpcYqrvp8
    ttps://www.youtube.com/watch?v=bFxnXH4-L1A
    https://www.youtube.com/watch?v=bFxnXH4-L1A&lc=UgxuODisjo6cvom7O-B4AaABAg.9w_AeS3JiK09wdi2XviwLG
    https://www.youtube.com/watch?v=bFxnXH4-L1A&lc=UgxBU39bTptFznDC1PJ4AaABAg
    ttps://www.youtube.com/watch?v=GqzeFYWjTxI
    https://www.youtube.com/watch?v=GqzeFYWjTxI&lc=UgwJnJDJ5JT8hFvibt14AaABAg
    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
    Last edited by DocAElstein; 11-30-2023 at 03:02 PM.

  3. #3
    Administrator Excel Fox's Avatar
    Join Date
    Mar 2011
    Posts
    1,402
    Rep Power
    10
    Phil,

    Welcome to Excel Fox

    You can simply call the function like so

    Code:
    Sub OLUIR(ribbon As IRibbonUI)
    
        On Error Resume Next
        If Val(Application.Version) = 14 Then
            ribbon.ActivateTabMso "TabAddIns" ' For Excel 2010
        ElseIf Val(Application.Version) = 12 Then
            Application.OnTime Now(), "ActivateMyTab" 'For Excel 2007
        End If
    
    End Sub
    
    Sub ActivateMyTab()
    
        ActivateTab "Add-Ins"
        
    End Sub
    A dream is not something you see when you are asleep, but something you strive for when you are awake.

    It's usually a bad idea to say that something can't be done.

    The difference between dream and aim, is that one requires soundless sleep to see and the other requires sleepless efforts to achieve

    Join us at Facebook

  4. #4
    Administrator Excel Fox's Avatar
    Join Date
    Mar 2011
    Posts
    1,402
    Rep Power
    10
    The code above is written to take care of Excel 2010 also....

    However, if you were only using 2010, you wouldn't need the IF condition
    Code:
    Sub OLUIR(ribbon As IRibbonUI)
    
        On Error Resume Next
            ribbon.ActivateTab "TabAddIns" ' For Excel 2010
    
    End Sub
    A dream is not something you see when you are asleep, but something you strive for when you are awake.

    It's usually a bad idea to say that something can't be done.

    The difference between dream and aim, is that one requires soundless sleep to see and the other requires sleepless efforts to achieve

    Join us at Facebook

  5. #5

  6. #6
    Administrator Excel Fox's Avatar
    Join Date
    Mar 2011
    Posts
    1,402
    Rep Power
    10
    Check the attachment...
    Attached Files Attached Files
    A dream is not something you see when you are asleep, but something you strive for when you are awake.

    It's usually a bad idea to say that something can't be done.

    The difference between dream and aim, is that one requires soundless sleep to see and the other requires sleepless efforts to achieve

    Join us at Facebook

  7. #7
    Junior Member
    Join Date
    Jan 2012
    Posts
    9
    Rep Power
    0

    I still can't seem to make it work

    I've attached my sample project. It has a menu which shows on the add-ins tab. With your code, I can't seem to give focus to it. I'm sure I missing something easy.
    Attached Files Attached Files

  8. #8
    Junior Member
    Join Date
    Sep 2012
    Posts
    3
    Rep Power
    0

    This example does not work in Excel 2007

    Hello,

    How To Activate A New Ribbon Tab.xlsm
    This is the example that I tried in Excel 2007.

    You asked me to start a new thread but the button to do so is not available. According to manual I do not have the rights probably. I have registered.

    If you open the example it creates the custom tab but gets an error 91 because the ReturnElement has value Nothing and cannnot call its method. In my opinion this is caused because GetAccessible does not find the custom tab in the control tree.

    Can you look into this example in spite of the fact that I did not create a new Thread?

    Thanks

    Rob Kemper

  9. #9
    Administrator Excel Fox's Avatar
    Join Date
    Mar 2011
    Posts
    1,402
    Rep Power
    10
    Rob, I tried in quite a few computers, and this is working without any error in all those computers.
    A dream is not something you see when you are asleep, but something you strive for when you are awake.

    It's usually a bad idea to say that something can't be done.

    The difference between dream and aim, is that one requires soundless sleep to see and the other requires sleepless efforts to achieve

    Join us at Facebook

  10. #10
    Junior Member
    Join Date
    Jan 2013
    Posts
    6
    Rep Power
    0
    Quote Originally Posted by Excel Fox View Post
    Rob, I tried in quite a few computers, and this is working without any error in all those computers.
    I can confirm that this example file does not work with excel 2007.
    The sub "ActivateTab" is not able to set "PageTabListClient".

    Regards

Similar Threads

  1. Test copy Activate Ribbon Tab In Excel 2007 2010 *
    By Excel Fox in forum Test Area
    Replies: 16
    Last Post: 01-22-2019, 05:05 PM
  2. Activate Ribbon Tab In Excel 2007 2010 *
    By Excel Fox in forum Test Area
    Replies: 16
    Last Post: 01-22-2019, 05:05 PM
  3. Replies: 1
    Last Post: 11-23-2013, 08:41 PM
  4. Ribbon DatePicker Calendar Control For Excel 2007-2010
    By Excel Fox in forum Excel Ribbon and Add-Ins
    Replies: 5
    Last Post: 10-12-2013, 11:23 AM
  5. Ribbon Calendar DatePicker Word 2007-2010
    By Excel Fox in forum Download Center
    Replies: 24
    Last Post: 09-23-2013, 09:07 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •