Consulting

Results 1 to 2 of 2

Thread: Creating a Folder in Sharepoint, if it does not already exist from an excel userform

  1. #1
    VBAX Newbie
    Joined
    Aug 2015
    Posts
    4
    Location

    Creating a Folder in Sharepoint, if it does not already exist from an excel userform

    Hi, I am trying to create a folder automatically if it does not exist already in sharepoint, the below code works fine for a shared drive, i just replaced the Path name with the URL ("https:\\etc...), but I keep getting bad file. I have tried changing the / to \ but to no avail. Is there an easy way to create a folder on sharepoint using VBA from an excel userform (i suppose it doesn't really need to check if the file exists as it should never already exist, i just thought it would be best to cover it just in case). I don't want to save the excel sheet to the folder, just simply create the folder at this stage.

    PTFolderName = Me.TextBox1.Value

    If Dir("https://workspace.Test.com/uk/Fix%20and%20Recover/7_PMT_%20Attachments/2_PMT_Additional_Attachments/" & PTFolderName, vbDirectory) = "" Then

    MkDir "//workspace.Test.com/uk/Fix%20and%20Recover/7_PMT_%20Attachments/2_PMT_Additional_Attachments/" & PTFolderName"

    End If

    Thanks

  2. #2
    VBAX Guru mancubus's Avatar
    Joined
    Dec 2010
    Location
    "Where I lay my head is home" :D
    Posts
    2,644
    hi.

    check if jkwan's posts in this thread resolves your issue:

    http://www.vbaexpress.com/forum/showthread.php?53332
    PLS DO NOT PM; OPEN A THREAD INSTEAD!!!

    1) Posting Code
    [CODE]PasteYourCodeHere[/CODE]
    (or paste your code, select it, click # button)

    2) Uploading File(s)
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) (multiple files can be selected while holding Ctrl key) / Upload Files / Done
    Replace company specific / sensitive / confidential data. Include so many rows and sheets etc in the uploaded workbook to enable the helpers visualize the data and table structure. Helpers do not need the entire workbook.

    3) Testing the Codes
    always back up your files before testing the codes.

    4) Marking the Thread as Solved
    from Thread Tools (on the top right corner, above the first message)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •