-
Task:
I need to create a temp directory for files to be stored in.
Knowledge:
I know about MkDir and RmDir.
Problem:
I am not allowed to create a directory if it already exists. I would like to have a way to verify the directory needs to be created.
Thank you for reading this
-
Use the Dir function to check if a folder exists.
Code:
If Dir("C:\MyDir", vbDirectory) = "" Then
MkDir "MyDir"
Else
Msgbox "Directory already exists!", vbCritical, "Error:"
End If
-
Matthew Gates
Once again you have come to the rescue.
THANKS!! That works just fine. I never knew about the vbDirectory portion of the command. I learned something new today.