Dim App As New MSExcel.Application
Dim Wb As MSExcel.WorkBook = App.WorkBooks.Open("E:\生猪管理系统\Reports\作价差.xls")
Dim Ws As MSExcel.WorkSheet = Wb.WorkSheets("作价差")
Dim Rg As MSExcel.Range = Ws.Rows("1:1")'选定首行
Dim rg1 As MSExcel.Range
rg1 = Ws.Cells(0,0)
If rg1.value <> "重量" Then
Rg.Delete(MSExcel.XlDirection.xlUp) '下面的单元格上移
End If
wb.save
wb.close
App.Quit
Dim mg As New Merger
mg.SourcePath = "E:\生猪管理系统\Reports\作价差.xls"
mg.Format = "excel" '指定格式
mg.SourceTableName = "作价差$" '指定要合并的表
mg.DataTableName = "作价差" '指定接收数据的表
mg.Merge() '开始合并