I'm trying to loop through all files in a Teams SharePoint folder, but I cannot get the FileSystemObject to recognize the address. First, I tried using the copy link for the folder in teams and then using this:
Dim fso As New FileSystemObject
Dim fldr As Folder: Set fldr = fso.GetFolder("address for sharepoint folder copied above")
But it always tells me it can't find it. I also tried something very similar for exact files in that folder Dim fl As File: Set fl = fso.GetFile("address")
but still wouldn't work
Then I googled and found this link: Get the content of a sharepoint folder with Excel VBA but it still errors on oNetwork.MapNetworkDrive DriveLetter & ":", NetworkPath
when trying to find that location.
I also tried replacing the / with \ and removing the https: but still no good. I've also tried getting the link from within Teams and within SharePoint. Still can't find it. If I put an Excel file in that folder and tell excel to open it with Application.Workbooks.Open("address")
that will open an excel file. But I just can't get the Dir or FileSystemObject to recognize the address. I'm suspicious it might have something to do with not using the correct address but for the life of me I can't find another address link in SharePoint. I'd really appreciate any help someone can give me.
I'm specifically trying to do this in MS Access but also tested in Excel with the same results.
EDIT: I ended up punting on this one. What I ended up doing is have the user select the "Add shortcut to OneDrive" and throw an error message if they haven't and giving instructions on how to do so with the message. There wont' be a lot of users needing this specific feature, so it should be okay for my needs.