尝试访问sharepoint时找不到路径错误

时间:2020-12-20 20:33:57

I am using this code to loop through the files in sharepoint using excel VBA. This code is working fine when I am using the local drive path. But when I replace the path with my sharepoint path, I am getting an error saying 'Path Not Found' at fs.GetFolder

我使用此代码使用excel VBA循环访问sharepoint中的文件。当我使用本地驱动器路径时,此代码正常工作。但当我用我的sharepoint路径替换路径时,我收到一条错误,在fs.GetFolder上显示“找不到路径”

Please kindly advice

请善意的建议

Code I am using is:

我正在使用的代码是:

Private Sub CommandButton2_Click()

Dim folder As Variant
Dim f As File
Dim fs As New FileSystemObject
Dim fs1 As New OLEObject
Dim RowCtr As Integer
Dim FPath As String
Dim wb As Workbook
FPath = "my URL"
Set fs = CreateObject("Scripting.FileSystemObject")
RowCtr = 1
Set folder = fs.GetFolder(FPath)
'<=Variable Location
For Each f In folder.Files
   Cells(RowCtr, 1).Value = f.Name
   RowCtr = RowCtr + 1
Next f
End Sub

1 个解决方案

#1


2  

You'll need to map sharepoint to a Windows drive letter, as outlined in SharePoint StackExchange. Once it's mapped you'll be able to open as a local drive path.

您需要将sharepoint映射到Windows驱动器号,如SharePoint StackExchange中所述。一旦映射完毕,您就可以打开本地驱动器路径。

#1


2  

You'll need to map sharepoint to a Windows drive letter, as outlined in SharePoint StackExchange. Once it's mapped you'll be able to open as a local drive path.

您需要将sharepoint映射到Windows驱动器号,如SharePoint StackExchange中所述。一旦映射完毕,您就可以打开本地驱动器路径。