PDA

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



baz16
08-03-2015, 04:55 AM
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

mancubus
08-03-2015, 08:01 AM
hi.

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

http://www.vbaexpress.com/forum/showthread.php?53332