H
Huyeote
Hi all,
I have a workbook contains VBA code for work purpose and distribute it
to my collegues. I want to add code to either enable user to click a
button or even triggered by Workbook_Open event to save it as an Excel
addin and install it thereafter.
But I keep getting error message when I used different alternatives.
METHOD 1: AS FOLLOWING SIMPLE METHOD
Code:
--------------------
AddIns.Add(ThisWorkbook.FullName).Installed = True
--------------------
Excel returns Error 1004: Unable to copy add-in to liabrary. I guess
this is because our personal Addins folders are *hidden * and the Add
method can't access it.
METHOD 2: USING SAVEAS METHOD
Code:
--------------------
ThisWorkbook.SaveAs FileName:=fldr.Path & "\myAddin.xla" _
, FileFormat:=xlAddIn
AddIns("myAddin").Installed = True
--------------------
Note: fldr is a variable containing full path of the Addins folder.
This method yields Error 9: subscript out of range. When I manually
selete the addin file the code copied to liabrary folder
(Add-Ins...\Browse...), Excel said the file is not a valid add-in.
Any help on this annoying issue will be appreciated.
Thanks
Huyeote
I have a workbook contains VBA code for work purpose and distribute it
to my collegues. I want to add code to either enable user to click a
button or even triggered by Workbook_Open event to save it as an Excel
addin and install it thereafter.
But I keep getting error message when I used different alternatives.
METHOD 1: AS FOLLOWING SIMPLE METHOD
Code:
--------------------
AddIns.Add(ThisWorkbook.FullName).Installed = True
--------------------
Excel returns Error 1004: Unable to copy add-in to liabrary. I guess
this is because our personal Addins folders are *hidden * and the Add
method can't access it.
METHOD 2: USING SAVEAS METHOD
Code:
--------------------
ThisWorkbook.SaveAs FileName:=fldr.Path & "\myAddin.xla" _
, FileFormat:=xlAddIn
AddIns("myAddin").Installed = True
--------------------
Note: fldr is a variable containing full path of the Addins folder.
This method yields Error 9: subscript out of range. When I manually
selete the addin file the code copied to liabrary folder
(Add-Ins...\Browse...), Excel said the file is not a valid add-in.
Any help on this annoying issue will be appreciated.
Thanks
Huyeote