Dim t As Table = Tables("窗口2_table1")
Dim App As New MSExcel.Application
Dim Wb As MSExcel.WorkBook = App.WorkBooks.Open("C:\temp\fs.xls")
Dim Ws As MSExcel.WorkSheet = Wb.WorkSheets("订单信息")
Dim Rg As MSExcel.Range = Ws.Rows("2:30000")'选定多行
Rg.Delete(MSExcel.XlDirection.xlUp) '下面的单元格上移
Dim rge As MSExcel.Range
For i As Integer = 1 To 15
For j As Integer = 1 To 51
rge = ws.cells(i ,j)
rge.value = t.Rows(i)(j)
Next
Next
wb.save
APP.quit
是想把窗口的表里的数据写入到EXCEL文件,这样写会弹出一个对话框提示是否替换原来的文件,而且也会打不开这个文件,提示文件已打开。