Hi all,
Hoping someone can help me with this "Run-time error '76': Path not found" problem that im getting
I have a sharepoint directly mapped to my C drive, and im using this code to try and create a folder in said directory but when running im getting an error
my foldername required is in the string strDirname which is housed in the sheet in cell a1
i dont know if the error is due to the way its grabbing the username however my username on windows is just my first name , all lower case no spaces
my error is coming up at this part MkDir folderPath & strDirname
im sure its something simple, but i cant figure it out
thanks in advance for any help offered
Hoping someone can help me with this "Run-time error '76': Path not found" problem that im getting
I have a sharepoint directly mapped to my C drive, and im using this code to try and create a folder in said directory but when running im getting an error
my foldername required is in the string strDirname which is housed in the sheet in cell a1
VBA Code:
Sub CreateSharePointDirectory()
Dim folderPath As String
Dim ans As String
Dim userName As String
Dim strDirname As String
strDirname = Sheets("Customer Profile").Range("a1")
userName = Replace(Application.userName, " ", ".")
folderPath = "C:\Users\" & userName & "\CompanyName\CompanyDocsFolder\Subfolder1\SubFolder2"
If Dir(folderPath, vbDirectory) = vbNullString Then
ans = MsgBox("Folder does not exist. Create?", vbYesNo)
If ans = vbYes Then
MkDir folderPath & strDirname
Else
Exit Sub
End If
End If
End Sub
i dont know if the error is due to the way its grabbing the username however my username on windows is just my first name , all lower case no spaces
my error is coming up at this part MkDir folderPath & strDirname
im sure its something simple, but i cant figure it out
thanks in advance for any help offered