BenjaminS
BenjaminS

Reputation: 25

How to make .xlam add-in functionalities workbook specific?

Currently my office is using an excel my team created to manage a certain kind of orders. This file has quite a lot of functionalities that are controlled by some hotkeys and a couple of userforms. Every couple of months when we want to add some new functions or repair some bugs every user needs to download the updated file. (The old file becomes unusable when a new version is available.)

To make this file more user friendly and to make it easier for us to manage the current version and distributing the new one I started to convert this file to an .xlam add in. I was inspired by a post a couple weeks/month ago about add in distributing in an office setting.

The problem I'm facing now is that ones the add in is loaded the add-in setting are used for every open workbook.

How I want the add in to be used is as follows:

When excel is started the add in tab is visible in the ribbon with 1 button visible. When this button is pressed a couple of sheets are added to the workbook with the basic data that is needed. And all the other buttons are now visible and enabled.

The problem is that once that activation button is pressed all the other buttons are also visible and usable in every other workbook the user has open or opens.

So, my question is, is it possible to make the buttons of the custom ribbon (visible or not visible) workbook specific? And this way the functionalities of the add in only available when the activation button is pressed in that specific workbook. And lastly making the variables defined in the add in also workbook specific?

Is this all possible with an .xlam add in or do I need to start with VTSO?

Upvotes: 2

Views: 447

Answers (1)

Jenn
Jenn

Reputation: 647

It is possible to do this within the file. In your callback, you can use Call RefreshRibbon(Tag:=""), which won't return any macro matches (by design) and therefore all will be disabled. This is a great resource with several examples.

https://www.rondebruin.nl/win/s2/win013.htm

Upvotes: 1

Related Questions