I would like to use a wildcard to check if a folder exist. i have tried the following: "C:\Users\*\Desktop\New folder"
"C:\Users" & "*" & "\Desktop\New folder"
"C:\Users\ + "*" + "\Desktop\New folder"
i get, "bad file name or number." is there a way to do this?
"C:\Users" & "*" & "\Desktop\New folder"
"C:\Users\ + "*" + "\Desktop\New folder"
i get, "bad file name or number." is there a way to do this?
Code:
Sub TestForDir()Dim strDir As String
strDir = "C:\Users\*\Desktop\New folder\"
If Dir(strDir, vbDirectory) = "" Then
MkDir strDir
Else
MsgBox "Directory exists."
End If
End Sub