Set ExcelObj = CreateObject("Excel.Application")
'ExcelObj.Workbooks.Open sfilePath
ExcelObj.Visible = False
ExcelObj.Workbooks.Open sfilePath ,ForWriting, False
Set ExlSheet = ExcelObj.Workbooks(1).Worksheets(1)
For j=1 to i
ExlSheet.Cells(irow,j) = datatable.Value(j, 1)
next
ExcelObj.ActiveWorkbook.Save
ExcelObj.Application.Quit
Set ExcelObj = Nothing
set ExlSheet = Nothing
'实现
Sub SaveDatatable(sfilePath,irow)
Dim i, j
Dim ExcelObj, ExlSheet
i=datatable.GetSheet(1).GetParameterCount '取列数
Set ExcelObj = CreateObject("Excel.Application")
ExcelObj.Visible = False
ExcelObj.Workbooks.Open sfilePath ,ForWriting, False
Set ExlSheet = ExcelObj.Workbooks(1).Worksheets(1)
For j=1 to i
ExlSheet.Cells(irow,j) = datatable.Value(j, 1)
next
ExcelObj.ActiveWorkbook.Save
ExcelObj.Application.Quit
Set ExcelObj = Nothing
set ExlSheet = Nothing