3

我正在使用此代码使用 excel VBA 循环遍历 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
4

1 回答 1

2

您需要将共享点映射到 Windows 驱动器号,如SharePoint StackExchange中所述。映射后,您将能够作为本地驱动器路径打开。

于 2013-09-13T18:24:55.607 回答