Excel VBA打开Sharepoint文件夹并为其中的文件创build超链接列表

在被要求迁移到SharePoint之前,我使用了一组.xlsm文件来设置项目团队来pipe理项目。 我的项目pipe理器文件包括一个macros将去到指定的文件夹,并创build所有当前项目文件的超链接。 我保存了SharePoint上的.xlsm文件的集合,但是当我运行下面的macros(我在这里find – 谢谢!)时,收到与“Set xFolder = xFSO.GetFolder(xPath)”行相关的错误。 任何帮助将是伟大的。 我已经阅读了几个post,可能有答案,并尝试了一些代码调整,没有运气。

Sub Create_Hyperlinks_for_all_Current_Projects() Range("B8:D38").Clear MsgBox "Once you click OK, an explorer box will appear. Select the folder containing all the CSTPs and then click OK again. HINT: The folder containing all the CSTPs should be in the same folder this document was in and should be called ''CSTPs''. Links to all CSTPs will then appear in the white box on the Manager Menu." Dim xFSO As Object Dim xFolder As Object Dim xFile As Object Dim xFiDialog As FileDialog Dim xPath As String Dim I As Integer Set xFiDialog = Application.FileDialog(msoFileDialogFolderPicker) With xFiDialog .InitialFileName = ThisWorkbook.Path End With If xFiDialog.Show = -1 Then xPath = xFiDialog.SelectedItems(1) End If Set xFiDialog = Nothing If xPath = "" Then Exit Sub Set xFSO = CreateObject("Scripting.FileSystemObject") Set xFolder = xFSO.GetFolder(xPath) For Each xFile In xFolder.Files I = I + 2 ActiveSheet.Hyperlinks.Add Cells(I + 6, 2), xFile.Path, , , xFile.Name Next End Sub