How to unintall an xll function added?

337 views
Skip to first unread message

Sam Isaacson

unread,
Oct 8, 2016, 4:12:09 PM10/8/16
to Excel-DNA
I've been looking to look into this add-in for a while - great work btw.

I'm just going through the "getting started" document and have succesfully added the "AddThem(,)" function via 64 bit xll on Excel 2016. I installed via double-clicking on the xll file in the Distribution folder.

I observe the following:
1. The add-in is NOT visibly listed with other add-ins. From reading online, this would only happen if I installed it via the Excel Add-Ins dialog within Excel - is this true?
2. I have no option to uninstall this option anywhere?
3. It will not work on another computer and i couldn't find any trace of it within the Excel uncompressed file - this means it hasn't been installed inside a particular spreadsheet.
4. This new xll function has been added to my excel setup globally as it will work on a new sheet I create as well - but where is it now located?

So where does it go once loaded?

Thanks
Sam

Govert van Drimmelen

unread,
Oct 8, 2016, 7:12:43 PM10/8/16
to exce...@googlegroups.com
Hi Sam,

1. Yes. It is only listed in the Excel Add-Ins dialog (Alt+t, i) if it is installed there.

2. If it is installed in the Excel Add-Ins dialog, you can uncheck it there and the he add-in will be unloaded. Otherwise it can also be unloaded programmatically, but that's a bit tricky.

3. An .xll add-in is never associated with a particular workbook, but is an Excel-wide application add-in. It is never installed inside a workbook. Once loaded, the functions are available to all workbooks.

4. If installed as an add-in, Excel sometimes copies the .xll to an add-ins directory under you user profile. Usually (perhaps not always) Excel prompts on whether to do this, and I say 'No' to keep using the .xll from the directory where it was opened from initially.

I hope that makes sense. Please ask if any of this is still not clear.

Regards,
Govert
--
You received this message because you are subscribed to the Google Groups "Excel-DNA" group.
To unsubscribe from this group and stop receiving emails from it, send an email to exceldna+u...@googlegroups.com.
To post to this group, send email to exce...@googlegroups.com.
Visit this group at https://groups.google.com/group/exceldna.
For more options, visit https://groups.google.com/d/optout.

Sam Isaacson

unread,
Oct 9, 2016, 6:42:40 AM10/9/16
to Excel-DNA
Thanks. 

I'm trying to understand how the end-user (not me as a developer) usage would look like.

(1)
So when I just open the .xll by clicking on it, then it is loaded into ALL of my currently open Excel sessions. As soon as I quit Excel then any sheet loaded doesn't recognize the new function name, hence I deduce it has unloaded itself and was only attached to that Excel session. End users using such a product would then have to click (and load) the .xll every time they want to use your spreadsheet that relies on the functionality of your xll. Not a terrible inconvenience BUT I have had the privilege of working with actual end users and this might be too much to ask - sad but true. 

(2)
If I use the Excel provided Add-In manager then it gets added to the Excel instance on my PC/laptop globally. This is available in after I quite Excel but will also be available to ALL spreadsheets I use on a daily basis - this is fine if it's just some additional UDFs (regular end users won't notice) but not great if it relates to any UI/ribbon changes bespoke to a particular task only. This scenario is of course perfect for a library of additional functions that you want to have available globally.

(3)
How do you use it such that it is semi attached to a specific Excel workbook only? In this scenario, the .net code and changes are more targeted at a particular task. I'm sure you could attach VBA code to load/unload the xll on every corresponding open/close event of the spreadsheet you are distributing (with the xll residing in the same directory as spreadsheet). The only potential problem (if it causes bespoke UI changes) is that it will be available to all other spreadsheets that you have open simultaneously with the target sheet - unless you can tell it to Sandbox this running Excel instance somehow?

Is my understanding correct? Is there another way to achieve my distribution goal in (3) above?

Kind Regards, 
Sam

Govert van Drimmelen

unread,
Oct 9, 2016, 7:23:46 AM10/9/16
to exce...@googlegroups.com
Excel's .xll add-ins are loaded per-process (I'm not sure what you mean by a 'session') and the functions are available to all workbooks. There is no workbook-based scope for the functions as with VBA.

Excel does not give us a way to only have the functions available to a specific workbook.

It is not hard to have a double-click of the .xll file also cause it to be installed as an add-in loaded every time.

You might store your own information in some special workbooks (maybe as an xml part) that cause a function to behave differently when called from such a workbook, or cause the ribbon to display other options when such a workbook is active.

These fact might cause you to design your add-in a bit differently.

All of this is just how Excel .xll add-ins work. Excel-DNA does nothing special in this regards, but it is different to having a workbook with its VBA code embedded.

I'm hoping to work on some management for such scenarios next year.

-Govert

Sam Isaacson

unread,
Sep 21, 2018, 11:19:34 AM9/21/18
to Excel-DNA
Hi Govert

Just coming back to this after a while. Has anything changed in the intervening period?

My current thinking is to handle add-ins that are meant for a single workbook as follows:

Adding to the VBA Code in ThisWorkbook

Private Sub Workbook_Open()
    If Not AddIns("ClassLibrary1-AddIn64-packed").Installed = True Then
        AddIns("ClassLibrary1-AddIn64-packed").Installed = True
    End If
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
    If AddIns("ClassLibrary1-AddIn64-packed").Installed = True Then
        AddIns("ClassLibrary1-AddIn64-packed").Installed = False
    End If
End Sub


My question is what can be done about Excel when it crashes? I presume it would then bypass being handle by the graceful exit of running the Workbook_BeforeClose event and will thus leave the add-in "installed". How can this be overcome?

Thanks
Sam 
Reply all
Reply to author
Forward
0 new messages