|
- Sub Opiona()
- 'On Error Resume Next '// 发生错误,自动执行下一句,就是忽略错误
- Application.ScreenUpdating = False '//关闭屏幕刷新
- Application.DisplayAlerts = False '//关闭系统提示
- t = Timer '//开始时间
- Set SH0 = Sheets("Sheet1")
- SH0.Range("A2:I65536").ClearContents
-
- FileArr = FileAllArr(ThisWorkbook.Path, "*.xls?", ThisWorkbook.Name, True, False)
- For I = 0 To UBound(FileArr)
-
- Str_coon = "HDR=yes';Data Source =" & FileArr(I) '//OFFICE2003,2007 通用
-
- StrSQL = "SELECT '" & GetPathFromFileName(FileArr(I), True) & "' AS 工作簿" '//不要扩展名,就改为:false
- StrSQL = StrSQL & ",[编码],[状态],[规格],[接入号],[订单号],[下连端子],[下连端子规格],[下连设备]"
- StrSQL = StrSQL & " FROM [端子端口详情$A2:H]"
- IROW = SH0.Range("A65536").End(3).Row + 1
- SQLARR = GET_SQL_To_Arr(StrSQL, Str_coon, False)
- SH0.Range("A" & IROW).Resize(UBound(SQLARR, 1) + 1, UBound(SQLARR, 2) + 1) = SQLARR '//(0 TO X)的数组行列都要+1,(1 TO X) 的不要
- Next I
- Application.ScreenUpdating = True '//恢复屏幕刷新
- Application.DisplayAlerts = True '//恢复系统提示
- MsgBox "一共用时:" & Format(Timer - t, "#0.0000") & " 秒", , "北极狐提示!!" '//提示所用时间
- End Sub
复制代码 |
|