以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- Merger高速导入SourceTableName如何导入excel中所有的表? (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=192106) |
-- 作者:山中树人100 -- 发布时间:2024/5/29 9:58:00 -- Merger高速导入SourceTableName如何导入excel中所有的表? Merger高速导入SourceTableName如何导入excel中所有的表? 目前我设置只能导入sheet1$这个表 Dim dlg As New OpenFileDialog dlg.Filter = "所有文件|*.*|Excel2003文件|*.xls|Excel2007文件|*.xlsx" \'设置筛选器 dlg.MultiSelect = True If dlg.ShowDialog = DialogResult.Ok Then \'如果用户单击了确定按钮 MessageBox.Show("你选择的是:" & dlg.FileNames.Length & "个文件") If MessageBox.Show("是否合并?", "请确认!", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) = DialogResult.OK Then DataTables("半岛进出场记录").StopRedraw For Each fl As String In dlg.FileNames Dim mg As New Merger mg.SourcePath = fl mg.Format = "excel2007" \'指定格式 mg.SourceTableName = "sheet1$" \'指定要合并的表 mg.DataTableName = "半岛进出场记录" \'指定接收数据的表 mg.Merge() \'开始合并 Next MessageBox.Show("导入成功!", "恭喜!") DataTables("半岛进出场记录").ResumeRedraw End If End If |
-- 作者:有点蓝 -- 发布时间:2024/5/29 10:14:00 -- For Each fl As String In dlg.FileNames Dim Book As New XLS.Book(fl) for each Sheet As XLS.Sheet in Book.Sheets Dim mg As New Merger mg.SourcePath = fl mg.Format = "excel2007" \'指定格式 mg.SourceTableName = Sheet.name & "$" \'指定要合并的表 mg.DataTableName = "半岛进出场记录" \'指定接收数据的表 mg.Merge() \'开始合并 Next Next |