I am working on a system that has a main workbook and a number of custom "plugins".
The idea is that the end user opens the main workbook. This offers a choice of plugins. Whichever plugin is chosen customises the main workbook interface for the end user.
Whichever interface button is selected by the end user is redirected to the active plugin and runs the code in there. (Note that the procedure in the plugin may contain calls to procedures in the main workbook).
Currently the main workbook is a XLSM (I am thinking of changing this to a XLAM in the near future) and the custom plugins are merely XLSM workbooks. (Would change to XLAMs if this made it any easier)
The main workbook calls code in the plugins as follows
- The current plugin workbook is opened (in the background)
- The main workbook calls an Application.Run
- At the start of the first procedure in the plugin, the plugin workbook loads a reference to the Main Workbooks project
- The plugin runs whatever procedure was called
- The main workbook closes the plugin after the Application.Run completes
- The plugin has an event trigger on workbook close to unload the reference to the main workbook
I'm looking for ideas on how to improve the calls between the two workbooks. Or any alternative concepts similar to what I am trying to do.
Should I make the plugins XLAM? (but I don't want them installed or appearing in the Add-Ins library)
I occasionally run into issues with the Application.Run (sometimes you cant debug). Instead of adding the main workbook as a reference to the plugin, should I add the plugin as a reference to the main workbook? (Which would do away with the need for Application.Run) This would mean that all plugins would have to have the same project name, correct?
Bookmarks