Dim dlg As New OpenFileDialog '定义一个新的OpenFileDialog
dlg.Filter= "Excel文件|*.xls|Excel文件|*.xlsx" '设置筛选器
If dlg.ShowDialog = DialogResult.Ok Then '如果用户单击了确定按钮
Dim mg As New Merger
mg.SourcePath = dlg.FileName
If dlg.FileName.EndsWith(".xls")
mg.Format = "excel" '指定格式
Else
mg.Format = "excel2007" '指定格式
End If
mg.SourceTableName = "花色$"
mg.DataTableName = "花色"
mg.Merge()
End If
[此贴子已经被作者于2018/8/23 20:14:57编辑过]