'For install an addinn named "MyAddInn.xla" in the Template
'folder you have to stop Excel and run the next script
'having the addin in the same folder
Set Sh = createobject("WScript.Shell"
Set Ex = createobject("Excel.Application"
With Ex
Templ = .application.TemplatesPath
End With
Ex.Quit
path = Wscript.ScriptFullName
Cale = Left(path, InstrRev(path, "\")
Set fso = createobject("scripting.filesystemobject"
If fso.FileExists(Cale&"MyAddInn.xla" then
Set Adr = fso.GetFile(Cale&"MyAddInn.xla"
On Error Resume Next
Adr.Copy(Templ&"MyAddInn.xla"
If Err.number <> 0 Then
Sh.PopUp "Excel is open having MyAddInn.xla installed. "&vbcrlf&_
Err.Description& " - Copy over AddInn opened !"&vbcrlf&_
"In 10 seconds we will stop !",6,"Worning !!!",48
Err.Clear
WScript.Quit
End If
Else
Sh.PopUp "The file MyAddInn.xla is not in the active folder. We will stop !!",10,"Worning",48
WScript.Quit
End If
On Error GoTo 0
Set Ex = createobject("Excel.Application"
With Ex
.Workbooks.Add
.Application.Addins.Add(.Application.TemplatesPath & "MyAddInn.xla".Installed = True
Set a = .Application.AddIns("For Test" 'The Title - In Properties - Summary
If a.Installed = True Then
Sh.PopUp "MyAddInn.xla installed !",6,"Confirmation !!!",48
Else
MsgBox "Problems !?!"
End If
End With
Ex.quit
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.