Dim dlg As New OpenFileDialog '定一个新的OpenFileDialog
Dim s1 As String
dlg.Filter= "Excel文件|*.xls" '|文本文件|*.txt|Access文件|*.mdb" '设置筛选器
If dlg.ShowDialog = DialogResult.Ok Then '如果用户单击了确定按钮
s1 = dlg.FileName
If s1<> " " Then
Dim Book As New XLS.Book(s1)
Dim ss3 As String = Book.Sheets(0).Name + "$"
Dim mg As New Merger
mg.SourcePath = s1
mg.Format = "excel" '指定格式
mg.SourceTableName = ss3 '指定要合并的表
mg.DataTableName = "客户信息" '指定接收数据的表
mg.Filter = "[身份证号] <> ''" '指定合并条件
mg.Merge() '开始合并
End If
End If