我正在尝试将数据从外部工作簿加载到数组中,以运行For
循环并获取:
错误1004 C:无法找到文件路径/.../.../。xlsx,请检查文件名的拼写并验证位置是否正确。
我确保拼写正确,并确保路径正确。该文件通常驻留在网络驱动器上,因此我将其移动到我的桌面以确定。
Bitlocker或安全套件会干扰吗?
'Error happens on second line
TargetPath = "C:\Users\Me\Desktop\ldgt1.xlsx"
Set TargetWorkbook = Workbooks.Open(TargetPath)
Set SourceWorkbook = ThisWorkbook
'This is where I am loading the array with a for loop
ArraySize = WorksheetFunction.CountA(TargetWorkbook.Worksheets(1).Columns(1))
ReDim Array(ArraySize)
For i = 1 To ArraySize
numbers(i) = Cells(i, 1).Value
Next i