In Excel I recorded a macro to open a file on OneDrive for Business and the code it generated was something below which works fine:
Workbooks.Open Filename:= "https://mycopmanymy.sharepoint.com/personal/john/Documents/John/Shared/Support/SDM%20Rebates%20v30.xlsm"
The problem is that for this to work the program must know exactly the file name. What I was hoping is that the VBA would scan that specific folder and open each file so I just removed the file name and used the same URL and used the following code:
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oFolder = oFSO.GetFolder("https://mycopmanymy.sharepoint.com/personal/john/Documents/John/Shared/Support/")
For Each oFile In oFolder.Files
Debug.print(oFile.Name)
Next
This gives me path not found error. Please note that I do not want to use a local C: path since the idea is that the users will put files in the shared folder and will run the macro on their end (i.e. my local path might be different than their local path).
Thanks!