I need to find a way to programmatically, using Excel VBA, create a folder in a Sharepoint Document Library. The Sharepoint Document Library already exist, and it has already one level of folders in it. The new sub-folder to be created will have a specific name which can be passed on by the Excel macro. Is it possible to construct an URL to the Sharepoint site that includes the command to create a sub-folder with a specific name?

1 Answer 1

Dim strDate As String
     Dim strTime As String
     strDate = Date
     strTime = Time
     strDate = Format(Now(), "mmmdd yyyy hh mm")
       Dim strURL As String
       ''Copy and paste the URL of your sharePoint folder where you want to create another folder
       strURL = "http://Your URL"

       strURL = Replace(Replace(strURL, "http:", ""), "/", "\")

      ' MsgBox strDate, vbInformation
     Dim Fld_r As String
     Fld_r = strURL & strDate                
     MsgBox Fld_r, vbInformation
    If Dir(Fld_r, vbDirectory) Then
    MkDir (Fld_r)
    End If
  • This doesn't seem to work with the latest version of the Office 365 & Sharepoint.
    – sifar
    Nov 10, 2021 at 16:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.