Hi to all,
I get an error when trying to install an Excel add-In (.xlam) from Xojo with this code
dim xls as new ExcelApplication
dim sPathFrom as String,
'Vars
sPathFrom="C:\\MyAddin.xlam"
'Installing add-in
xls.AddIns.Add "MyAddin",sPathFrom
xls.AddIns.Item("MyAddin").Installed=True
MsgBox "Done"
Can someone tell me what is wrong ?
Did you copy the MSOfficeAutomation plugin (located in the Extras folder of the installation) to the Plugins folder?
You also have an extra comma at the end of:
dim sPathFrom as String> , <
which will throw an error.
Hi Julian,
Thanks for your replay. Sure, the MSOfficeAutomation plugin is already copied in the plugins folder.
When I try to run the code I get the an OLEException.
Error Number -2147352567
Message: The Add property of the AddIns class can not be obtained. (Failed on 'Add')
Now I’m not sure if the problem is from MSOffice plugin or if I’m using the class erroneously.
Hi Elvis,
This works on my computer with an AddIn called “ButtonEditor”:
[code]Dim xl as new ExcelApplication
xl.Workbooks.Add
xl.Visible = True
Dim sPathFrom as String
sPathFrom = “C:\Users\eugen\Downloads\ButtonEditor\ButtonEditor.xla”
xl.AddIns.Add(sPathFrom).Installed = True
[/code]
Does this work for you?
Hi Eugene,
Works fine ! Really thanks. The issue was in the property ‘.Installed’
xl.AddIns.Add(sPathFrom).Installed = True
Regards,