但是,你要把excel的数据合并到哪个表呢?注意标红的地方
Dim dlg As New OpenFileDialog '定义一个新的OpenFileDialog
dlg.Filter= "Execl文件|*.xlsx" '设置筛选器
dlg.MultiSelect = True '允许选择多个文件
If dlg.ShowDialog = DialogResult.Ok Then '如果用户单击了确定按钮
For Each file As String In dlg.FileNames
Dim mg As New Merger
mg.SourcePath = file '指定数据文件
mg.SourceTableName = "report$" '指定要导入的表
Dim f As new FileInfo(file)
mg.DataTableName=f.Name.Replace(f.Extension,"")
msgbox(mg.DataTableName)
mg.Format ="Excel"
mg.FieldMaps.Add("F6","编码")
mg.FieldMaps.Add("F9","数量")
mg.FieldMaps.Add("F10","类型")
mg.Filter = "[F6] like '0%' " '指定合并条件
mg.Merge()
Next
End If
[此贴子已经被作者于2016/11/24 17:46:07编辑过]