以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 添加导入文件对话框 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=145544) |
-- 作者:rgbjwjb -- 发布时间:2020/1/29 11:06:00 -- 添加导入文件对话框 老师,新年好! 下面的导入代码只能选择固定名称和固定路径的文件,我想增加一个对话框,用来实现可以选择要导入的文件,请问如何修改?谢谢!(帮助文件中只能选择导入一个工作表,我的“二期融资”工作簿中有上百个工作表) Dim Book As New XLS.Book("C:\\Users\\1234\\Desktop\\二期融资.XLS") Tables("收款明细表").StopRedraw() For i As Integer = 0 To Book.Sheets.Count -1 Dim Sheet As XLS.Sheet = Book.Sheets(i) Dim nms() As String = {"债权人","借款日期","借款年限","利率","收取金额","收据号码","凭证号码","备注"} For n As Integer = 1 To Sheet.Rows.Count -1 Dim r As Row = Tables("收款明细表").AddNew() For m As Integer = 0 To nms.Length - 1 r(nms(m)) = Sheet(n,m).Value Next Next Next Tables("收款明细表").ResumeRedraw()
|
-- 作者:有点蓝 -- 发布时间:2020/1/29 14:10:00 -- 参考:http://www.foxtable.com/webhelp/topics/0328.htm Dim dlg As New OpenFileDialog \'定义一个新的OpenFileDialog dlg.Filter= "Excel文件|*.xls;*.xlsx|" \'设置筛选器 If dlg.ShowDialog = DialogResult.Ok Then \'如果用户单击了确定按钮 Dim Book As New XLS.Book(dlg.FileName) …… ……
End If |