views:

290

answers:

1

I am trying to work out a solution to share most of my VBA codebase across workbooks. This involves creating a .xlam file that would contain the shared modules & classes (+ their respective factories).

I'm willing to use Office 2007's wonderful RibbonUI, and have that .xlam file declare a custom tab (Let us call it MyTab for the sake of the argument). I need MyTab to only display some elements if the user has specific permissions (which I manage through VBA).

Besides that, I want my other workbooks to be able to add stuff into MyTab, which may also have dynamic elements (that use VBA).

The issue I'm facing is that whenever I get in the case where a workbook references the AddIn.xlam and declares dynamic ribbon elements, Excel tries to refresh all at once, thus calling VBA code in two separate threads (I guess), which eventually fails (because VBA is single-thread-forced in Excel), and generates blank dialog boxes with just "400" written on those and two buttons "OK" and "Help".

Has someone got experience on how to best tackle this issue?

A: 

Have you tried setting Application.MultiThreadedCalculation = False.

I believe that will correct your issue.

Irwin M. Fletcher
I'll try this when I come back from holiday :)
Romain
That partially fixed it. But it drove other issues. I guess the core design of VBA breaks my use case... I'm going to use other ways now... :)
Romain