这里简单介绍下vb script 脚本的基本语法:
后面可以参考这个例子:
Sub 创建任务脚本_Click()
Dim Line As String
Dim ColumnStr As String
Dim Substr As String
Dim Str, Val, n
max_line = 20000
Set fs = CreateObject("Scripting.FileSystemObject")
sFilename = ThisWorkbook.Path + "\..\..\Sources\sql\output.sql"
Set fhandle = fs.CreateTextFile(sFilename, True)
i = 1
For i = 1 To 200 '显示修改历史记录预设200行
If (Cells(i, 1) = "修改历史") And UCase(Cells(i, 2)) = "BEGIN" Then
j = i + 1
fhandle.WriteLine ("-- 修改历史:")
While Not (Cells(j, 1) = "修改历史" And UCase(Cells(j, 2)) = "END")
fhandle.WriteLine ("-- " & Cells(j, 1) & " -" & Cells(j, 2) & " -" & Cells(j, 3) & " -&