以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  请教导入  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=83577)

--  作者:hbhb
--  发布时间:2016/4/12 18:18:00
--  请教导入
袍兄:请问如何批量导入一个excel文件中的100张表?代码怎么写?
--  作者:大红袍
--  发布时间:2016/4/12 19:49:00
--  
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 ip As New Importer
        ip.SourcePath = dlg.FileName
        ip.SourceTableName =  sheet.Name & "$" \'指定要导入的表
        ip.NewTableName = sheet.name.trim()  \'导入后的表名
        ip.Format = "Excel" \'指定导入格式
        ip.Import()
    Next
End If