Hello,
I have a couple of databases that I'm using custom ribbons for. I've created a module containing all the global ribbon variables and functionality. Here is what happens when the ribbon is instantiated:
Then various pieces of code have methods to invalidate the ribbon controls:Code:Public Sub OnRibbonLoad(ByVal ribbon As IRibbonUI) Set gRibbon = ribbon gRibbon.InvalidateControl ("menu") End Sub
So I notice when I've been modifying the application, and it's been open a long time, sometimes the gRibbon variable loses its value, so none of the Invalidate code ever gets run.Code:If Not gRibbon Is Nothing Then gRibbon.InvalidateControl "{RibbonID}" End If
I know if I close and re-open the database, everything runs fine. I'm worried that if my customer has the database open for a long time, the same thing will happen in production.
Rather than having to train them to close and reopen the database, is there a way to refresh the global object? I've tried playing with CommandBars collection, and that seems to work, but I'm worried about that type of object being deprecated, as I've seen some things about that in the help documents.
Is there an easy way to locate my custom ribbon after the fact and fix the problem as needed? For example:
Thanks...Code:If gRibbon Is Nothing Then 'Do this to reinstantiate the object End If