+ Reply to Thread
Results 1 to 4 of 4

Custom UI Ribbon - Preserve checkbox checked state on reopening workbook

  1. #1
    Registered User
    Join Date
    01-15-2020
    Location
    Melbourne, Australia
    MS-Off Ver
    2016
    Posts
    29

    Custom UI Ribbon - Preserve checkbox checked state on reopening workbook

    Hi everyone!

    I have a custom UI ribbon tab in one of my files which contains a checkbox. When the checkbox is pressed it returns a value of 1 in a specific cell and 0 if unchecked. When I close this workbook and reopen, even though the cell has a value of 1, the checkbox appears unchecked.

    I was wondering if there is a way to preserve the last checked state of the checkbox before the workbook is closed? I am using the below code:
    Please Login or Register  to view this content.

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,419

    Re: Custom UI Ribbon - Preserve checkbox checked state on reopening workbook

    You need to return the stored value in the callback

    Please Login or Register  to view this content.
    Also ensure the control ID property matches with the text you are using.
    As you original code should have forced the checkbox to be ticked as you were always returning True.
    Attached Files Attached Files
    Cheers
    Andy
    www.andypope.info

  3. #3
    Registered User
    Join Date
    01-15-2020
    Location
    Melbourne, Australia
    MS-Off Ver
    2016
    Posts
    29

    Re: Custom UI Ribbon - Preserve checkbox checked state on reopening workbook

    Hi Andy,

    Thank you for your reply. I made the changes as suggested, however, the checkbox still appears unchecked even if it's value is 1. As you said, this might be something to do with the control ID not matching the text. In the custom UI, the ID of the checkbox is "cb_RD". I am attaching a sample file and the checkbox is located in the "Financial Analysis" tab in the ribbon. Is there something that I am doing wrong?

    Would be really grateful if you could take a look.

    Thanks
    Shashank
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    01-15-2020
    Location
    Melbourne, Australia
    MS-Off Ver
    2016
    Posts
    29

    Re: Custom UI Ribbon - Preserve checkbox checked state on reopening workbook

    All good, I think I figured out what I was missing - I hadn't enabled the "getpressed" property in the custom UI!.

    Thank you so much for your help.

    Cheers
    Shashank

+ 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. save state of a custom checkbox on ribbon
    By glda19 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-22-2019, 07:59 AM
  2. [SOLVED] Custom Ribbon Toggle Button, how do I change state with VBA?
    By dd12 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-24-2019, 11:27 AM
  3. get status checkbox on custom menu ribbon.
    By glda19 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-16-2019, 02:19 PM
  4. [SOLVED] Activate button upon checkbox selection in custom ribbon
    By SunOffice in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-17-2015, 09:26 PM
  5. [SOLVED] When checkbox is checked it does not copy to new sheet. Only if not checked using false
    By thelisa in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-28-2013, 07:59 AM
  6. [SOLVED] Dynamic menu arrays (custom ribbon tab) only partly rebuilt after loss of state recovery
    By mc84excel in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-11-2013, 09:57 PM
  7. Replies: 1
    Last Post: 06-21-2006, 04:50 PM

Tags for this Thread

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