I have tried a few different ways of checking now and none have worked so far. Here is the most recent version which did not work:
This will make the folder in the right directory but if I run the function again with the same parameters and the folder already existing it will tell me the folder does not exist and then I will get #VALUE instead of 0 in the cell which looks bad.
TestDir is always blank even when the directory does exist.
What am I doing wrong?
Code:
Public Function MakeFolder(Directory As String, FolderName As String)
Dim TestDir As String
TestDir = Dir(Directory + "/" + FolderName)
If TestDir = "" Then
MsgBox "File doesn't exist"
MkDir (Directory + "/" + FolderName)
Else
MsgBox "File exist"
End If
End Function
This will make the folder in the right directory but if I run the function again with the same parameters and the folder already existing it will tell me the folder does not exist and then I will get #VALUE instead of 0 in the cell which looks bad.
TestDir is always blank even when the directory does exist.
What am I doing wrong?