http://www.foxtable.com/webhelp/scr/1152.htm
Dim dlg As New OpenFileDialog
dlg.Filter = "Excel文件|*.xls;*xlsx"
dlg.MultiSelect = False
Dim find As Boolean
Do While not find
If dlg.ShowDialog =DialogResult.OK Then
Dim fl As String = dlg.FileName
Dim Book As New XLS.Book(fl)
For Each Sheet As XLS.Sheet In Book.Sheets
If sheet.name = "临时工表" Then
find = True
Exit For
End If
Next
If find Then
Dim mg As New Merger
mg.Format = "excel"
mg.SourcePath = fl
mg.SourceTableName = "临时工表$"
mg.DataTableName="临时工表"
mg.Merge()
MessageBox.show("导入成功!","提示")
DataTables("临时工表").DataCols("时间").RaiseDataColChanged()
Else If MessageBox.Show("文件不正确,是否重新选择?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = DialogResult.No
Exit Do
End If
End If
Loop