I am trying to get access the share point folder and files using VBA.
I have tried the same code to access the local folders and files it was working perfectly fine.
Here is my folder structure from share point. I need to access all the files inside the folder
Mainfolder
Folder 1
Folder 2
Folder 3
Folder 4
Option Explicit
Sub Somesub()
Call GetFiles("https://isharenew.xyz.com/main folder \")
End Sub
Sub GetFiles(ByVal path As String)
Dim spSite As String
Dim fso As Object
Set fso = CreateObject("Scripting.FileSystemObject")
Dim folder As Object
Set folder = fso.GetFolder(path)
Dim subfolder As Object
Dim file As Object
For Each subfolder In folder.SubFolders
GetFiles (subfolder.path)
Next subfolder
For Each file In folder.Files
Range("L" & Rows.Count).End(xlUp).Offset(1, 0) = file.path
Next file
Set fso = Nothing
Set folder = Nothing
Set subfolder = Nothing
Set file = Nothing
End Sub
With my above code I am getting error Path Not Found
Please let me know where I am doing mistake.