如果我输入了一个URL链接,代码就无法正常工作,但如果它从我的硬盘中获取,它确实有效。任何建议?或者我应该使用Microsoft Access?
Sub import_metering_actaris()
Dim directory As String, fileName As String, sheet As Worksheet, total As Integer
Application.ScreenUpdating = False
Application.DisplayAlerts = False
*****directory = "https://app.box.com/files/0/f/11396351585/1/f_95668743837"
fileName = Dir(directory & "CS-FQC MV-001-01 Rev B (ACTARIS).xls")*****
Do While fileName <> ""
Workbooks.Open (directory & fileName)
For Each sheet In Workbooks(fileName).Worksheets
total = Workbooks("qc-generator.xlsm").Worksheets.Count
Workbooks(fileName).Worksheets(sheet.Name).Copy _
after:=Workbooks("qc-generator.xlsm").Worksheets(total)
Next sheet
Workbooks(fileName).Close
fileName = Dir()
Loop
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub
它在目录&amp;中得到错误文件名,任何帮助将不胜感激。 谢谢