Dim dlg As new OpenFileDialog dlg.Filter = "Excel|*.xls;*.xlsx" If dlg.ShowDialog = DialogResult.OK Then Dim book As new XLS.Book(dlg.FileName) For Each sheet As XLS.Sheet In book.Sheets Dim Result As DialogResult Result = MessageBox.Show("是否要导入" & sheet.name & "表", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) If Result = DialogResult.Yes Then Dim ip As New Importer ip.SourcePath = dlg.FileName ip.SourceTableName = sheet.Name & "$" '指定要导入的表 ip.NewTableName = sheet.name.trim() '导入后的表名 ip.Format = "Excel" '指定导入格式 ip.Import() End If Next End If
|