以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 如何将文件的固定路径改为动态路径? (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=188342) |
-- 作者:lin98 -- 发布时间:2023/9/15 10:20:00 -- 如何将文件的固定路径改为动态路径? 如何将文件的固定路径改为动态路径? Dim Book As New XLS.Book("D:\\问题\\WTSJ\\采购单.xlsx")\'D盘的路径 Dim Sheet As XLS.Sheet = Book.Sheets(0) Dim dr As DataRow Dim a As Integer
|
-- 作者:有点蓝 -- 发布时间:2023/9/15 10:34:00 -- http://www.foxtable.com/webhelp/topics/0328.htm |
-- 作者:lin98 -- 发布时间:2023/9/15 11:44:00 -- Dim Book As New OpenFileDialog \'定义一个新的OpenFileDialog Book.Filter = "Excel文件|*.xls|Word文件|*.doc|Access文件|*.mdb" \'设置筛选器 If Book.ShowDialog = DialogResult.Ok Then \'如果用户单击了确定按钮 MessageBox.Show("你选择的是:" & Book.FileName, "提示") \'提示用户选择的文件 End If Dim Sheet As XLS.Sheet = Book.Sheets(0) Dim dr As DataRow Dim a As Integer For i As Integer = 1 To Sheet.Rows.Count - 1 Select Case sheet(i, 0).Text Case "单据编号:" dr = DataTables("主表").AddNew dr("单据编号") = sheet(i, 1).Text 报错
|
-- 作者:有点蓝 -- 发布时间:2023/9/15 11:54:00 -- |
-- 作者:有点蓝 -- 发布时间:2023/9/15 11:55:00 -- Dim dlg As New OpenFileDialog dlg.Filter = "Excel文件|*.xls"
If dlg.ShowDialog = DialogResult.OK Then Dim Book As New XLS.Book(dlg.FileNames)\'D盘的路径 Dim Sheet As XLS.Sheet = Book.Sheets(0) Dim dr As DataRow Dim a As Integer End If |
-- 作者:lin98 -- 发布时间:2023/9/15 12:12:00 -- Dim dlg As New OpenFileDialog dlg.Filter = "Excel文件|*.xls" If dlg.ShowDialog = DialogResult.OK Then Dim Book As New XLS.Book(dlg.FileNames)\'D盘的路径 Dim Sheet As XLS.Sheet = Book.Sheets(0) Dim dr As DataRow Dim a As Integer End If For i As Integer = 1 To Sheet.Rows.Count - 1 Select Case sheet(i, 0).Text Case "单据编号:" dr = DataTables("采购主表").AddNew dr("单据编号") = sheet(i, 1).Text 上面代码或图上代码都报图上提示的错
|
-- 作者:有点蓝 -- 发布时间:2023/9/15 13:33:00 -- Dim dlg As New OpenFileDialog dlg.Filter = "Excel文件|*.xls" If dlg.ShowDialog = DialogResult.OK Then Dim Book As New XLS.Book(dlg.FileName)\'D盘的路径 Dim Sheet As XLS.Sheet = Book.Sheets(0) Dim dr As DataRow Dim a As Integer For i As Integer = 1 To Sheet.Rows.Count - 1 Select Case sheet(i, 0).Text Case "单据编号:" dr = DataTables("采购主表").AddNew dr("单据编号") = sheet(i, 1).Text End If
|
-- 作者:lin98 -- 发布时间:2023/9/15 16:42:00 -- 此主题相关图片如下:文件路径问题-3.jpg 测试一下,报错
|
-- 作者:有点蓝 -- 发布时间:2023/9/15 16:54:00 -- 变量名称定义重复了 |
-- 作者:lin98 -- 发布时间:2023/9/15 17:37:00 -- 我没找到重复,如何改?谢谢 |