Dim dlg1 As new OpenFileDialog
dlg1.Filter = "Excel文件|*.xls;*xlsx"
dlg1.MultiSelect = True
If dlg1.ShowDialog = DialogResult.OK Then
For Each f As String In dlg1.FileNames
Dim App As New MSExcel.Application
try
Dim Wb As MSExcel.WorkBook = App.WorkBooks.Open(f)
For Each s As object In Wb.WorkSheets
Dim ip As New Importer
ip.SourcePath = f
ip.SourceTableName = s.Name & "$"
ip.NewTableName = "表C"
ip.Format = "Excel"
app.quit
ip.Import()
Next
catch ex As exception
app.quit
End try
Next
End If
Dim tnames() As String = {"表A", "表B"}
Dim dlg2 As new SaveFileDialog
dlg2.Filter = "Excel|*.xls"
For Each tname As String In tnames
If dlg2.ShowDialog = DialogResult.OK Then
Dim ex As New Exporter
ex.FilePath = dlg2.FileName
ex.SourceTableName = tname
ex.Format = "Excel"
ex.Export()
End If
Next
Dim Builder As New ADOXBuilder
Builder.Open()
With Builder
.DeleteTable("表C")
End With
Builder.Close()
Syscmd.Project.Open(ProjectFile)