Ribbon in a loop after reset

Paul Sansom

Board Regular
Joined
Jan 28, 2013
Messages
178
Office Version
  1. 2021
  2. 2016
Platform
  1. Windows
Hi
After rersetting the ribbon, my workbook is in run mode, and i cannot update the workbook sheets.

Is there a way that i can identify and repair the ribbon items that appear to be casuing the loop?
I am unclear on how to determine which item(s) are causing the ribbon to stay in run mode after invalidating and resetting it?

FYI - The workbook contains many sheets. 4 custom ribbon menus each with a variatey of buttons, editboxes and textboxes.

Any help/guidance on how to find loopy code much appreciated (or please advise if more information is needed)

Cheers Paul

My refresh ribbon code is below & I believe is pretty standard
Code:
Sub RefreshRibbon(Tag As String)
    MyTag = Tag
    If Rib Is Nothing Then
        Set Rib = GetRibbon(Sheet2.Range("RibRV").Value)
        Application.StatusBar = " There was an error in the RibbonBar Initialisation - Reset in progress - please wait"
'        Rib.Invalidate
    Else
        Rib.Invalidate
    End If
    
End Sub
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Have you tried setting breakpoints in your code and debugging it?

I've created customized ribbons, even some with menu options that change. I never had an issue with a hanging ribbon refresh.
 
Upvote 0
Hi Jeff
Yes i have.without too much success.
I am begining to belive the problem might be caused by the _getLabel subs for some buttons. These seem to be running continually.
I was changing the labels dependant upon consitions
I might try to remove these and just have fixed (non changing labels) and see if that solves it.
Cheers Paul
 
Upvote 0
Oh, You have events that run when you change cells that contain the labels for the buttons?

You need to do a couple things:

You need a Public boolean variable called RibbonInvalidate or something to store the status of the Invalidate process. Before Invalidate:
Application.EnableEvents = FALSE
RibbonInvalidate = TRUE

After Invalidate:
Application.EnableEvents = TRUE
RibbonInvalidate = FALSE

In each of the Ribbon process subs, just add a statement like this:
IF RibbonInvalidate = TRUE then Exit Sub

Does that make sense?
 
Last edited:
Upvote 0
Yes this all makes sense.
I have the events that run when a button is pressed.(_onChange) AND I change the button labels with if statements in the sub (_getLabel).
The if statements are linked to Boolean cells that change so, yes I have events that run and change the cell contents and change the labels.

I will amend the subs with the suggestions above and see. I'll post here on the outcome.
Many thanks for the persistent and patient help.

Cheers Paul
 
Upvote 0
Since I can't see all your Ribbon SUBS, I can only guess at some things. Some of your Ribbon Process Subs will need to run when Invalidate is called so they can re-label the buttons. You'll have to decide which ones those are. It may be that Disabling Events will solve the problem. Usually this is a trial and error for me.
 
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,306
Members
452,633
Latest member
DougMo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top