-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInstall.vbs
40 lines (35 loc) · 1.11 KB
/
Install.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
33
34
35
36
37
38
39
40
'=========================================================================================
'SetUp ExcelAddIn
'=========================================================================================
dim FILLE_NAME
Rem FILLE_NAME is determined by parent folder name of this script
Call Exec
Sub Exec()
Dim objExcel
Dim strAdPath
Dim strMyPath
Dim strAdCp
Dim strMyCp
Dim objFileSys
Dim oAdd
'-- CreateObject
Set objExcel = CreateObject("Excel.Application")
Set objFileSys = CreateObject("Scripting.FileSystemObject")
'-- Set Path
strAdPath = objExcel.Application.UserLibraryPath
strMyPath = Replace(WScript.ScriptFullName, WScript.ScriptName, "")
FILLE_NAME=objFileSys.getFilename(strMyPath) & ".xlam"
strAdCp = objFileSys.BuildPath(strAdPath, FILLE_NAME)
strMyCp = objFileSys.BuildPath(strMyPath, FILLE_NAME)
'-- CopyFile
objFileSys.CopyFile strMyCp, strAdCp
'-- Add to Excel
objExcel.Workbooks.Add
Set oAdd = objExcel.AddIns.Add(strAdCp,True)
oAdd.Installed = True
objExcel.Quit
'-- Free Object
Set objExcel = Nothing
Set objFileSys = Nothing
MsgBox "Complete!"
End Sub