Hello,
I have a macro that needs to create a folder on SharePoint, then generate and save multiple files under that folder. I've done a lot of work to get the code right for creating the folder, but with no success. I've read that you need to drop the http: from the front of the folder address, change all of the / to \ and change any %20 to space. I've done all those things and still get the error "Run-time error '75': Path/File access error."
I do have permission to create a folder on the SharePoint site and tested that by actually creating one. I can also Open in Explorer and create a folder that way.
Below is the code I'm using to create the folder (with the filepath changed). The macro continues on after what's posted to create the files within that folder.
I have a macro that needs to create a folder on SharePoint, then generate and save multiple files under that folder. I've done a lot of work to get the code right for creating the folder, but with no success. I've read that you need to drop the http: from the front of the folder address, change all of the / to \ and change any %20 to space. I've done all those things and still get the error "Run-time error '75': Path/File access error."
I do have permission to create a folder on the SharePoint site and tested that by actually creating one. I can also Open in Explorer and create a folder that way.
Below is the code I'm using to create the folder (with the filepath changed). The macro continues on after what's posted to create the files within that folder.
VBA Code:
Sub PDF_User_Graphs()
'
Dim ws As Worksheet
Dim sourcesheet As Worksheet
Dim strDirname As String
Dim strPathname As String
Dim strDefpath As String
Set sourcesheet = ActiveSheet
Application.ScreenUpdating = False
'Create new month folder
strDirname = Format(Sheets("Inputs").Range("B2"), " yyyy-MMM") ' New folder name
MkDir "\\my.sharepoint.website\sites\departments\test\Test\Test Test\Test Test" & strDirname