Hello there,

I have an extensive custom excel add-in which engages in all sorts of macros when opening certain files (tests are done on workbook open before performing any of the macros) and the add-in includes a custom ribbon. Until recently this add-in has only been used on windows, but I've recently been working on getting it functional on Mac as well.

If I open a new, clean workbook in Excel, the ribbon loads fine every time. The issue that I'm having arises when I try to open one of my special files which engage all of the complex macros. In these cases the ribbon loads inconsistently. Sometimes the ribbon will load once all of the Workbook_Open macros finish running, but most of the time it won't. I've checked to see if the on_Load code fires in these cases and it does not. An IRibbonUI never gets assigned.

Given what I've seen, it seems to me like some process that happens while all my workbook_open macros are firing off is interfering with the ribbon's on_Load callback, and I'm not sure how to address it.

My code is typical for loading a custom ribbon:
Code:
Option Explicit

Private myRibbon As IRibbonUI
Private CollapseToggle As Boolean

Public Sub ribb******er(ribbon As IRibbonUI)
    Set myRibbon = ribbon
    CollapseToggleState = True
End Sub
The CollapseToggleState is a global variable that controls one of the toggle buttons in my ribbon which I set to true by default.

Is there a way to ensure that the ribbon loads before or after all of the other macros run? I've tried using an Application.Wait within the on_Load callback, but this did nothing. I've also tried putting the on_Load callback in ThisWorkbook and making the ribbon Public rather than keeping the on_Load callback in the module with the rest of the ribbon code. I'm at a loss since I can't reproduce the issue consistently and I'm not as familiar with the workings of Excel on Mac as I am on Windows.

Note, this is never an issue on my windows version of Excel, with the same exact code. I would love to hear any recommendations of things to try or ways to debug this issue. Thanks in advance and please let me know if there is any other information I can provide that would be helpful.