Allow code in custom functions add-in to limit the function list at runtime

Allow code in custom functions add-in to limit the function list at runtime
2

Upvotes

Upvote

 Aug 24 2022
2 Comments (2 New)
New

We use Excel's JavaScript custom functions add-ins for various "sets" of custom functions that user may or may not have access to depending on their job role. Unfortunately, that means we have to have five different add-ins (one for each set of functions) that we enable/disable via AD membership. This is complicated to maintain, cumbersome to administer, and cluttered -- the add-ins also need a toolbar button, and of course there ends up having to be one for each add-in.

 

Instead, we'd much rather be able to have code that runs when the add-in loads that tailors the list of functions available to the current user based on that user's identity. Then we could have a simple add-in and not have to deal with cross add-in messaging, multiple toolbar buttons

 

To minimize the implementation effort to support, one approach would be to continue to have the functions defined by a JSON file as they are now, but add a hook of some kind during the loading process that the add-in can use to remove functions from the list.

 

TIA

Comments
Copper Contributor

It's possible to do this currently, but it's not officially supported and is a bit temperamental AFAICT (see https://stackoverflow.com/a/73229697/2644016). I found it only works after the task pane in shared runtime has been opened.

Copper Contributor

@JamesDuley  - That's very interesting, thanks! I'll have to play with it!