By submitting your personal information, you agree that TechTarget and its partners may contact you regarding relevant content, products and special offers.
exists and if is doesn't then it creates it. It assumes that the parent
directory exists, so if in doubt then call the function several times starting
at the root.
This is a useful function if, like me, you want to control the detaching of
documents so that they are placed using script in the same sub directory on all
To call the function:
The Function itself:
Function CheckForCreateDirectory(DirPath As String)
'This function checks for a subdirectory given the parent, and if it doesn't
exist it creates it
'Extract the different elements of the full path
Do While continue=False
If Instr(DirName,"\") Then
'Check for directory and add if it doesn't exits
CheckDir = Dir$(ParentDirPath,16)
Do While CheckDir <> ""
If Ucase(CheckDir) = Ucase(DirName) Then
CheckDirFlag = True
CheckDir = Dir$()
If CheckDirFlag=False Then