用代码来合并一张7千多行的数据表 大根需要7,8秒的时间.但是通过杂项里面的高速合并按钮来合并的话速度可能就是1秒的样子现在我想怎么通过代码来实现高速合并表这一动作呢? 我现在写的代码入下
Dim dlg As New OpenFileDialog '定义一个新的SaveFileDialog
dlg.Filter= "Excel文件|*.xls;*.xlsx" '设置筛选器
If dlg.ShowDialog = DialogResult.Ok Then '如果用户单击了确定按钮
'导入前先删除所有行
DataTables("顺丰账务总表").DeleteFor("")
Dim App As New MSExcel.Application
Dim Wb As MSExcel.WorkBook = App.WorkBooks.Open(dlg.FileName)
Dim Ws As MSExcel.WorkSheet = Wb.WorkSheets(1)
导入数据
Dim mg As New Merger
mg.SourcePath = dlg.FileName
mg.Format = "excel" '指定格式
mg.SourceTableName = ws.Name & "$" '指定要合并的表
mg.DataTableName = "顺丰账务总表" '指定接收数据的表
mg.Merge()
App.Quit
End If
[此贴子已经被作者于2020/11/9 11:02:29编辑过]