+ Reply to Thread
Results 1 to 20 of 20

Disabled Button On Ribbon

  1. #1
    Forum Contributor
    Join Date
    12-25-2012
    Location
    gent,belgium
    MS-Off Ver
    Excel 2021
    Posts
    146

    Disabled Button On Ribbon

    Hi

    Can some told me what im dowing wrong?
    I want to disabled button 2 from Group2 on the ribbon.

    But when i click on the button Disable Button2 of group2 he enabled the button.
    So i thought i make a new sub GetDisabledMarco.
    But he always activade the macro GetEnabaledMacro
    So my Xml code is
    Please Login or Register  to view this content.
    Attached Files Attached Files

  2. #2
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,906

    Re: Disabled Button On Ribbon

    Very simple, if you check you vba code the macro doesn not exist, that's exactly what the message tells you
    Check the vba module with the ribbon macros
    Good-night!
    ---
    Hans
    "IT" Always crosses your path!
    May the (vba) code be with you... if it isn't; start debugging!
    If you like my answer, Click the * below to say thank-you

  3. #3
    Registered User
    Join Date
    07-13-2022
    Location
    Ga
    MS-Off Ver
    2010
    Posts
    25

    Re: Disabled Button On Ribbon

    I do not see what you are trying to do, but as the code goes.

    [code]
    tag="Group1Button1" getEnabled="GetEnabledMacro"/>
    <button id="G1B2" label="Caption 2" size="normal" onAction="Macro2" imageMso="AccountMenu"
    tag="Group1Button2" getEnabled="GetEnabledMacro"/>
    <button id="G1B3" label="Caption 3" size="normal" onAction="Macro3" imageMso="RegionLayoutMenu"
    tag="Group1Button3" getEnabled="GetEnabledMacro"/>
    </group>

    <group id="MyCustomGroup2" label="Group2" tag="MyPersonalGroup2" >
    <button id="G2B1" label="Caption 1" size="normal" onAction="Macro4" imageMso="DirectRepliesTo"
    tag="Group2Button1" getEnabled="GetEnabledMacro"/>
    <button id="G2B2" label="Caption 2" size="normal" onAction="Macro5" imageMso="AccountMenu"
    tag="Group2Button2" getEnabled="GetDisabledMarco"/>
    <!-- button id="G2B2" label="Caption 2" size="normal" onAction="Macro5" imageMso="AccountMenu"
    tag="Group2Button2" getEnabled="GetEnabledMacro"/ -->


    [code\]


    button id G2B2 you have two. the second you have commented out has a viable macro call.

    the first has "GetDisabledMarco" which does not exist.

  4. #4
    Forum Contributor
    Join Date
    12-25-2012
    Location
    gent,belgium
    MS-Off Ver
    Excel 2021
    Posts
    146

    Re: Disabled Button On Ribbon

    I have now put the macro to it.
    What im trying to do is to disable not alle the buttons but one button by tag.
    And when i click eanbled all all the buttons must be enabled. now button2 off group 2 is disabled
    By Clicking on disabled all buttons must be disabled and now button2 of group 2 is enabled.

    How can i disable one button by tag that is what im trying to do.
    Attached Files Attached Files
    Last edited by glda19; 01-29-2024 at 02:00 AM.

  5. #5
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,906

    Re: Disabled Button On Ribbon

    May I ask you a question: do you have any idea how the ribbon tags work?
    My guess is you read something you like and you copied it without any notion of how the ribbon works.
    I suggest you read moer about it. I can advise you a a good site: https://www.macexcel.com/examples/ri.../contextmenus/
    Ron stopped with Windows but the Ribbon Context part in the MAC is the same as in Windows
    I have returned your file with extra info in the message box so you can see how the button is identified
    Attached Files Attached Files

  6. #6
    Forum Contributor
    Join Date
    12-25-2012
    Location
    gent,belgium
    MS-Off Ver
    Excel 2021
    Posts
    146

    Re: Disabled Button On Ribbon

    No i don't now how ribbon tags work.
    Why did you give me the following linkhttps://www.macexcel.com/examples/ri.../contextmenus/
    I see that it is the explanation of the context menu by right click not about ribbon tags

    Where do i find more info about ribbon tags.
    Last edited by glda19; 01-29-2024 at 12:06 PM.

  7. #7
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,906

    Re: Disabled Button On Ribbon

    Have you even tried to read the article? Try to understand?
    What's the use if you do not even put an effort into understanding the basics of how the ribbon works?
    You can look at your own file I attched back to you and open the ribbon editor

  8. #8
    Forum Contributor
    Join Date
    12-25-2012
    Location
    gent,belgium
    MS-Off Ver
    Excel 2021
    Posts
    146

    Re: Disabled Button On Ribbon

    What have the context menu to make with tags

  9. #9
    Forum Expert
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    2,047

    Re: Disabled Button On Ribbon

    Most disappointingly, Ron de Bruin has removed the Windows part of this (previously) excellent site.

    However you can still access it on the archive, so this should be of some use to you.

    https://web.archive.org/web/20180802.../s2/win012.htm

    https://web.archive.org/web/20180802.../s2/win013.htm
    Last edited by ByteMarks; 01-29-2024 at 12:26 PM.

  10. #10
    Forum Contributor
    Join Date
    12-25-2012
    Location
    gent,belgium
    MS-Off Ver
    Excel 2021
    Posts
    146

    Re: Disabled Button On Ribbon

    I understand how you can use a tag to enbled the button.
    But how can i do disable with a tag

  11. #11
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,906

    Re: Disabled Button On Ribbon

    Okay, let's say you do know how that works.
    What do you want to achieve with these buttons?
    You cannot enebale it if it's disabeld so can you explain what you really need?

  12. #12
    Forum Contributor
    Join Date
    12-25-2012
    Location
    gent,belgium
    MS-Off Ver
    Excel 2021
    Posts
    146

    Re: Disabled Button On Ribbon

    I found a site of Ron de bruine ho explain how to program the ribbon. But he stopped the Windows excel site. He only have macexcel.com alive.
    the file i post here is from Ron.
    What I want is to see if it possible to disable one button on the ribbon by tag.
    I store the example so I can see in the further how I must program the ribbon
    Informatics is not my job. I have to hold sole values ore other thinks to control if they give the value correctly in the system that we use at work so I payed correctly

    So I made a excel file where I hold the hours I no a certain job. And when there is a code in a Cell not is filled in then I generated a pdf that I mail to my boss

  13. #13
    Forum Contributor
    Join Date
    12-25-2012
    Location
    gent,belgium
    MS-Off Ver
    Excel 2021
    Posts
    146

    Re: Disabled Button On Ribbon

    So now I'm leaving more about the ribbon programming and I want to see if it is possible to disable one button on the ribbon by tag

  14. #14
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,906

    Re: Disabled Button On Ribbon

    You can enable or disable a single button by checking a condition of a value in a cell of some other action.
    I know his site is now for the macexel but if you look carefully you can see that the ribbon section is the same for both versions and ByteMarks posted two links and there you can actually download a file that does what you want, but you will have to at least understand how it all works, especially if you are going to do some more compliacted actions like mailing pdfs and so.

  15. #15
    Forum Contributor
    Join Date
    12-25-2012
    Location
    gent,belgium
    MS-Off Ver
    Excel 2021
    Posts
    146

    Re: Disabled Button On Ribbon

    But is disable on the links by tag for one button I doet think so.
    I want to now if it is possible by tag

  16. #16
    Forum Expert
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    2,047

    Re: Disabled Button On Ribbon

    Here's a way you can do it using the tags.

    Firstly you need to amend the callback in your xml so that GetEnabled for all the buttons refers to to GetEnabledMacro

    In the VBA:
    Declare the variable blnNot
    Please Login or Register  to view this content.
    Modify Sub GetEnabledMacro as follows:
    Please Login or Register  to view this content.
    Modify Sub RefreshRibbon as follows
    Please Login or Register  to view this content.
    Change Sub disableControlGroup2Button2 as follows
    Please Login or Register  to view this content.
    Attached Files Attached Files

  17. #17
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,906

    Re: Disabled Button On Ribbon

    Looks good, I hope the OP understands the workings and takes the time to read more about the Ribbon

  18. #18
    Forum Expert
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    2,047

    Re: Disabled Button On Ribbon

    Thanks.
    The Ribbon is a bit of a learning curve if you are new to it.

    Strongly recommend the rorya method to preserve the ribbon state too, referenced in the OP's code. I've added the links here as Ron's site is now expired.

    https://www.mrexcel.com/board/thread...bon-ui.518629/

    https://web.archive.org/web/20110528...ibbonstate.htm

  19. #19
    Registered User
    Join Date
    07-13-2022
    Location
    Ga
    MS-Off Ver
    2010
    Posts
    25

    Re: Disabled Button On Ribbon

    ok, took a while. but the attached is done without your tags.

    I'm learning the marrage between XML and VBA. Its not clean (ie left the tag in xml & some other stuff) by you should get the concept.
    Attached Files Attached Files

  20. #20
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,906

    Re: Disabled Button On Ribbon

    Quote Originally Posted by ByteMarks View Post
    Thanks.
    The Ribbon is a bit of a learning curve if you are new to it.
    I agree, it took me some time and a lot of Ron-tips reading time.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Macro button to replace ribbon button
    By Tirans in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-07-2022, 08:37 AM
  2. [SOLVED] Radio button disabled
    By fgfgicare in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 08-01-2020, 12:46 AM
  3. [SOLVED] Problem Copying between two workbook with ribbon toolbars disabled
    By dentler in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-20-2017, 02:08 PM
  4. disabled (greyed out) ribbon icons
    By JohnnyJebel in forum Excel General
    Replies: 3
    Last Post: 04-17-2015, 09:30 PM
  5. Replies: 4
    Last Post: 07-17-2014, 12:04 PM
  6. [SOLVED] Disabled X button but wish to create 'Exit' button
    By danlRB80 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-16-2014, 02:43 PM
  7. Replies: 3
    Last Post: 03-25-2014, 11:05 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1