以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- [求助]导入 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=122223) |
-- 作者:江南小镇 -- 发布时间:2018/7/21 7:22:00 -- [求助]导入 老师好,下面代码找不到Excel(2010)的文件。另存为2013工作簿是找得到的。 \'-----获取Excel文件名 Dim dlg As New OpenFileDialog dlg.Filter = "Excel文件|*.xls" Dim bookName,sheetName As String If dlg.ShowDialog = DialogResult.OK Then bookname = dlg.FileName e.Form.Controls("bookName").text = bookName \'-----定义excel文件----- Dim Book As New XLS.Book(bookname) \'------遍历表名----- For Each st As xls.sheet In book.sheets sheetName = sheetName & st.name & "|" Next \'------设置默认值 Dim stname As WinForm.ComboBox = e.Form.Controls("sheetname") stname.combolist = sheetname.TrimEnd("|") stname.SelectedIndex = 0 Dim btn As WinForm.Button = e.Form.Controls("读出数据") btn.PerformClick() End If
[此贴子已经被作者于2018/7/21 7:54:03编辑过]
|
-- 作者:有点蓝 -- 发布时间:2018/7/21 9:14:00 -- dlg.Filter = "Excel文件|*.xls;*.xlsx" |
-- 作者:江南小镇 -- 发布时间:2018/7/21 15:22:00 -- 谢谢老师 |