I want to test for a path on the network to see if it exists, and create the various folders I need if they are missing. Say my folders are called abc, def and ghi. I wanted to check for all for all three and create each as necessary using the code below. Will using the elseif skip the others or will it go through each if regardless?
Is there an easier way to do this or can I just check for "ghi" and have all three created in the process if they are not present?
Code:
If Dir("..file_path\abc\", vbDirectory) = "" Then
MkDir ("..file_path\abc\")
ElseIf Dir("..file_path\abc\def\", vbDirectory) = "" Then
MkDir ("..file_path\abc\def\")
ElseIf Dir("..file_path\abc\def\ghi\", vbDirectory) = "" Then
MkDir ("..file_path\abc\def\ghi\")
End If
Is there an easier way to do this or can I just check for "ghi" and have all three created in the process if they are not present?
Last edited: