-
Notifications
You must be signed in to change notification settings - Fork 4
/
run.wsf
50 lines (36 loc) · 1.1 KB
/
run.wsf
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
41
42
43
44
45
46
47
48
49
50
<job> <script language="VBScript" src="..\..\..\create-MS-Office-app.vbs" />
<script language="VBScript">
option explicit
dim wshShell
set wshShell = createObject("WScript.Shell")
if wscript.arguments.count <> 1 then
wscript.echo("Specify version of file to be inserted (1 or 2)")
wscript.quit
end if
dim sourceVersion
sourceVersion = wscript.arguments(0)
if sourceVersion <> "1" and sourceVersion <> "2" then
wscript.echo("Specify version of file to be inserted (1 or 2)")
wscript.quit
end if
dim xls
dim app
dim xlsFileName
xlsFileName = currentDir() & "created.xlsm"
if sourceVersion = 1 then
set xls = createOfficeApp("excel", xlsFileName)
set app=xls.application
else
set xls = openOfficeApp("excel", xlsFileName)
set app = xls.application
end if
app.visible = true
'
' If sourceVersion = 2, insertModule replaces the module named func (because
' it already exists)
'
call insertModule(app, currentDir() & "functions-v" & sourceVersion & ".bas", "func", 1)
app.run "main"
xls.save
</script>
</job>