ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Save & Install AddIn with VBA (https://www.excelbanter.com/excel-programming/311171-save-install-addin-vba.html)

matt

Save & Install AddIn with VBA
 
I'm trying to write code to save an activeworkbook as an
addin and then install the addin just saved. Can anyone
help me with this?

Thanks,
Matt

Hayes0

Save & Install AddIn with VBA
 
Something like


Sub SaveAddIn()
Dim MyName As String, Shortname As String, MyPAth As
String
Dim MyAddIn as String, xlAddIn as AddIn
Application.DisplayAlerts = False
With ThisWorkbook
MyName=.Name
Shortname=replace(MyName,".xls","")
MyAddin=Shortname & ".xla"
'Save as Add in
MyPAth = .Path & "\"
.IsAddin = True
.SaveAs Filename:=MyPAth & MyAddIn,
FileFormat:=xlAddIn
'Save as Workbook again otherwise you won't be able to
see the sheets
.IsAddin = False
.SaveAs MyPAth & Shortname & ".xls",
addtoMRU:=True
End With



On Error resume next
'De Install it
Application.Addins(MyaddIn).Installed=false
'Re Install it
Set xlAddIn=Application.Addins.Add (Mypath &
MyAddIn,true)
xlAddIn.Installed=true
On error goto 0
Application.DisplayAlerts = True
End Sub


-----Original Message-----
I'm trying to write code to save an activeworkbook as an
addin and then install the addin just saved. Can anyone
help me with this?

Thanks,
Matt
.



All times are GMT +1. The time now is 10:35 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com