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

时间:2013-07-11 19:04:12

标签: vba sharepoint excel-vba excel

我正在使用此代码使用excel VBA遍历sharepoint中的文件。当我使用本地驱动器路径时,此代码工作正常。但是,当我用我的sharepoint路径替换路径时,我收到一条错误消息,说“未找到路径”'在fs.GetFolder

请提出建议

我正在使用的代码是:

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 个答案:

答案 0 :(得分:2)

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