var fs = require('fs');
var list = [
'AT20160318001-邓君',
'20160318002-石名',
'20160318003-郭芷'
];
// 批量生成文件模板
var template = fs.createReadStream('template.xls');
for (var i = 0; i < list.length; i++) {
template.pipe(fs.createWriteStream(list[i] + '.xls'));
}
Sub autoFiller()
For i = 1 To 100
' get filename
Dim name As String
name = Application.ActiveSheet.Range("H" & CStr(i + 2)) & Application.ActiveSheet.Range("I" & CStr(i + 2)) & "-" & Application.ActiveSheet.Range("B" & CStr(i + 2)) & ".xls"
' declare obj
Set ObjExcel = CreateObject("Excel.Application")
Set ObjWb = ObjExcel.Workbooks.Open("D:\auto\list\" & name)
' operation
Dim f4 As String
f4 = Application.ActiveSheet.Range("F" & CStr(i + 2))
ObjWb.Worksheets("Sheet1").Range("F4").Value = f4
' savefile
ObjWb.Save
ObjWb.Close
ObjExcel.Quit
'cleanup
Set ObjWb = Nothing
Set ObjExcel = Nothing
Next i
End Sub