jimmisavage
Board Regular
- Joined
- Jun 28, 2017
- Messages
- 130
Hi all,
I have a VBA that loops through a folder, opening all files and doing some work on them. It works very well sat on an internal shared drive.
We're switching to Office365 so I would like this VBA to loop through the files in a SharePoint and open them in the excel desktop app (I think this is important for my VBA to be able to make the necessary changes to the files?)
My current code looks like this:
I have tried changing the line folderName = "C:\Users\Reports\Updates" with the "copy link" URL from SharePoint but this just gives me a Run-time error '52' Bad file name or number. Can anyone suggest what changes i'd need to make to this code for it to work?
Thanks in advance
I have a VBA that loops through a folder, opening all files and doing some work on them. It works very well sat on an internal shared drive.
We're switching to Office365 so I would like this VBA to loop through the files in a SharePoint and open them in the excel desktop app (I think this is important for my VBA to be able to make the necessary changes to the files?)
My current code looks like this:
VBA Code:
Private Sub Workbook_Open()
folderName = "C:\Users\Reports\Updates"
If Right(folderName, 1) <> Application.PathSeparator Then folderName = folderName & Application.PathSeparator
fname = Dir(folderName & "*.xlsx")
Do While Len(fname)
With Workbooks.Open(folderName & fname)
Select Case ActiveWorkbook.Worksheets("Status").Range("A1")
Case "Open" ...
I have tried changing the line folderName = "C:\Users\Reports\Updates" with the "copy link" URL from SharePoint but this just gives me a Run-time error '52' Bad file name or number. Can anyone suggest what changes i'd need to make to this code for it to work?
Thanks in advance