-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstalladdin.vbs
32 lines (26 loc) · 1.09 KB
/
installaddin.vbs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
Dim Shell
Set Shell = WScript.CreateObject("WScript.Shell")
result = MsgBox ("This update requires Excel to close." & vbNewLine & vbNewLine & "ALL UNSAVED WORK WILL BE LOST!", vbOKCancel + vbExclamation, "ReportTool Update")
Select Case result
Case vbOK
Shell.Run "taskkill /f /im ""EXCEL.EXE""", , true
Case vbCancel
MsgBox "Update was cancelled", vbOKOnly + vbInformation, "ReportTool Update"
WScript.Quit
End Select
Shell.Run "taskkill /f /im ""EXCEL.EXE""", , true
On Error Resume Next
Dim oXL
Dim oAddin
Set oXL = CreateObject("Excel.Application")
oXL.Workbooks.Add
Set oAddin = oXL.AddIns.Add("T:\CSO\JL\tools\ReportTool.xlam", True)
oAddin.Installed = True
oXL.Quit
Set oAddin = Nothing
Set oXL = Nothing
If Err.Number <> 0 Then
MsgBox "Error: " & Err.Number & vbNewLine & "Srce: " & Err.Source & vbNewLine & "Desc: " & Err.Description, vbOKOnly + vbCritical, "ReportTool Update"
Else
MsgBox "Installed, please restart Excel" & vbNewLine & "The button can be found in the 'Add-Ins' option of the toolbar", vbOKOnly + vbInformation, "ReportTool Update"
End If