Dim dlg As New OpenFileDialog dlg.Filter= "Excel文件|*.xls|Word文件|*.doc|Access文件|*.mdb" If dlg.ShowDialog = DialogResult.Ok Then Dim book As new XLS.Book(dlg.FileName) Dim flag As Boolean = False For Each sheet As XLS.Sheet In book.Sheets If sheet.name = "sheet1" Then flag = True End If Next If flag Then Dim ip As New Importer ip.SourcePath = dlg.FileName ip.SourceTableName = "sheet1$" ip.NewTableName ="距离" ip.Format = "Excel" ip.Import() Else msgbox("不存在sheet1") End If End If
|