Hi I am running the following code, which was working great on my computer, and I tested it on a couple other computers no problem. But some computers started to have an error on the line Sheet1.Activate (not sure what the error is that my coworker got just that they needed to debug).
When I went to go test it, my debugger highlighted the line Set xfolder = xfs.GetFolder("//companydomain.sharepoint.com/projects/z Aerials/Photos") Run Time Error '76:Path not found (it said it could not find the path - but it was working a couple weeks ago and I don't think anything has changed). I'm not sure why I get a different error than my coworkers. We all use Sharepoint and have it logged in through file explorer. Suggestions to fix this code, or on code that will work better?
Thanks
When I went to go test it, my debugger highlighted the line Set xfolder = xfs.GetFolder("//companydomain.sharepoint.com/projects/z Aerials/Photos") Run Time Error '76:Path not found (it said it could not find the path - but it was working a couple weeks ago and I don't think anything has changed). I'm not sure why I get a different error than my coworkers. We all use Sharepoint and have it logged in through file explorer. Suggestions to fix this code, or on code that will work better?
Thanks
Code:
Sub CreateList()
Dim xfolder As Folder
Dim xf As File
Dim xfs As New FileSystemObject
Dim xRowCtr As Integer
Sheet1.Activate
xRowCtr = 2
Set xfolder = xfs.GetFolder("//companydomain.sharepoint.com/projects/z Aerials/Photos")
For Each xf In xfolder.Files
Cells(xRowCtr, 1).Value = xf.Path + xf.Name
xRowCtr = xRowCtr + 1
Next xf
End Sub