Forum

VBA; Creating a fol...
 
Notifications
Clear all

VBA; Creating a folder in Sharepoint.

2 Posts
2 Users
0 Reactions
859 Views
(@darkwing1711)
Posts: 31
Trusted Member
Topic starter
 

Hello all!

I'm trying to use MkDir to create a folder in SharePoint, but I'm getting a Run-time error '76': Path not found.  I've created a macro to save a copy of the file in that directory so I don't think the formatting is incorrect as far as spaces, slashes, etc.

Below is a sample code

NOTES:  On my actual document, I have the year in a range from a different sheet.  Below would be the result (just to make things simple) if it was a new year.  I've also tried the year with the slash after (/2020/) but still the same error.

 

Sub create_archivefolder ()

' Create year folder if needed

     Dim archive As String

     archive="https://company.sharepoint.com/teams/teamname/Shared Documents/General/report/Archive/2021" 'creates a new year

     On Error Resume Next 'Resumes if archive already exists

     MkDir (archive) 

End Sub

 

Thanks in advance!

Ken

 
Posted : 05/11/2020 4:27 pm
(@rhysand)
Posts: 80
Trusted Member
 
Good afternoon,

I don't know the answer, because I never used Sharepoint

but try to see if this can help you in any way

 

https://stackoverflow.com/questions/47523521/vba-checking-folder-file-exist-in-sharepoint

 

Miguel,

 
Posted : 09/11/2020 10:21 am
Share: