Results 1 to 2 of 2

Custom Ribbon Toggle Button, how do I change state with VBA?

Threaded View

  1. #1
    Registered User
    Join Date
    10-24-2019
    Location
    Baltimore, MD
    MS-Off Ver
    365
    Posts
    4

    Question Custom Ribbon Toggle Button, how do I change state with VBA?

    I have a Toggle button that activates code that changes the fill color of the sheet. I want to send up a message box warning the user before it erases the fill in all their cells and if they hit cancel then the code should set the toggle button state back to unclicked and exit the sub. I cant figure out how to set the toggle button state, here is my code:
    Public fFillBehavior As Boolean
    Sub btnFocusFill_Click(control As IRibbonControl, pressed As Boolean)
        fFillBehavior = pressed
        
        If pressed Then
            If MsgBox("This will remove the fill color of all your cells, do you still want to continue?", vbOKCancel) = vbOK Then
                fillEnable
            Else
                ' ENTER CODE TO CHANGE BUTTON STATE TO UNCLICKED
                Exit Sub
            End If
        Else
            fillDisable
        End If
    End Sub
    Any help is appreciated
    Thank you.
    Last edited by dd12; 10-24-2019 at 02:49 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] how do i make a toggle button change other toggle buttons value to false
    By kevinu in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 05-10-2018, 04:19 PM
  2. [SOLVED] Reset CustomUI Toggle Button state by cancelling Input Prompt
    By KiwiRickToo in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-12-2016, 07:35 AM
  3. Toggle Button in Ribbon Excel UI - After Reopening file it is not pressed
    By marzoumm in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-02-2014, 09:33 AM
  4. Need help locking 2 state toggle button
    By SJMaye in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-14-2013, 06:02 AM
  5. [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
  6. [SOLVED] Return Toggle Button to default state
    By Nu2Java in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-29-2012, 04:51 PM
  7. [SOLVED] Toggle Button 'State' Problem on Workbook Open
    By HangMan in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-11-2012, 06:35 AM

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