I seem to be running into errors with invalid paths and can't quite figure it out.
What I have is a userform that allows the user to enter the path they wish to save to (tbSaveTo) - when they click send it checks this path and
1st) it substitutes out "/" with "\" then
2nd) it checks to see if it ends with "\" - if not it adds it
3rd) checks if the directory then exists. it works the majority of the time but every so often it runs into issues and it appears to be issues whereever there are spaces in the directory names (ie: "My Documents").
Below is the code i use up to where my error msg is called
Anyone have any suggestions on possible causes/solutions/ideas?
What I have is a userform that allows the user to enter the path they wish to save to (tbSaveTo) - when they click send it checks this path and
1st) it substitutes out "/" with "\" then
2nd) it checks to see if it ends with "\" - if not it adds it
3rd) checks if the directory then exists. it works the majority of the time but every so often it runs into issues and it appears to be issues whereever there are spaces in the directory names (ie: "My Documents").
Below is the code i use up to where my error msg is called
Anyone have any suggestions on possible causes/solutions/ideas?
Code:
fPath = WorksheetFunction.Substitute(tbSaveTo.Value, "/", "\")
If Right(fPath, 1) <> "\" Then
fPath = "" & fPath & "\" & ""
'i've tried the above and also jsut fpath = fpath & "\"
Else
fPath = "" & fPath & ""
'i've tried the above and also jsut fpath w/o ""double quotes
End If
If Len(Dir(fPath)) = 0 Then
MsgBox "here is where my error msg is called"