Friday 1 December 2017

Excel add-in not loading when opening Excel from VBA


I'm using excel reg-ex add-in and it works well, the only problem with it that it doesn't load when excel is started by VBA.


I've a macro in word to collect some data in Word and copy it to excel, this one starts excel, the output is fine, but I need to restart excel to be able to use the add-in (it's enabled in the options, just not loading).


I've tried another macro: just open excel and create a new workbook and it has the same issue.


I've only this one 3rd party add-in so I can't compare to other ones.


Any idea?



Answer



I've solved it based on answer posted to a similar question in stackoverflow: https://stackoverflow.com/a/806720/4721734



I looked into this problem again, and the Application.Addins collection seems to have all the addins listed in the Tools->Addins menu, with a boolean value stating whether or not an addin is installed. So what seems to work for me now is to loop through all addins and if .Installed = true then I set .Installed to False and back to True, and that seems to properly load my addins.


Function ReloadXLAddins(TheXLApp As Excel.Application) As Boolean

Dim CurrAddin As Excel.AddIn

For Each CurrAddin In TheXLApp.AddIns
If CurrAddin.Installed Then
CurrAddin.Installed = False
CurrAddin.Installed = True
End If
Next CurrAddin

End Function

No comments:

Post a Comment

Where does Skype save my contact's avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...