在下面的代码里加入进度条!
For Each file As String In filesys .GetFiles("\\Win-ukpedgbcajr\财务部狐表业务系统\产品统计\产品开piao信息")
If file.EndsWith(".xls") OrElse file.EndsWith(".xlsx") Then
Dim Book As New XLS.Book(file)
Dim Sheet As XLS.Sheet = Book.Sheets(0)
Dim jsdw As String = sheet(11,1).Text '结算单位在Excel中的坐标位置
Dim nms() As String = {"行号","商品编号","商品名称","单据日期","单据类型","单据编号","出库数量","原币出库金额","开piao数量","原币开piao金额","未开piao数量","原币未开piao金额","超额开piao数量","原币超额开piao金额","手工开piao数量","原币手工开piao金额"}
' Tables("成品统计表").StopRedraw()
For n As Integer = 16 To Sheet.Rows.Count -1 '注意下面的循环变量从17开始,而不是从0开始,因为Excel表的第1-16行是标题和列名
Dim r As Row = Tables("成品统计表").AddNew()
For m As Integer = 0 To nms.Length - 1
r(nms(m)) = Sheet(n,m).Value
Next
r("结算单位") = jsdw
Next
End If
Next
这个代码写在按钮(导入数据)里面,单击按钮显示找不到名称为“ProgressBar1”的控件!
[此贴子已经被作者于2019/3/13 10:20:09编辑过]