Re: VBA - create a folder if not already present
This is function to create the directory working perfactly , here is another vba function to create multiple directories.
Code
Public Function MakeDir(ByVal STRPATH As String) As Boolean
If Right(STRPATH, 1) = "\" Then
STRPATH = Left(STRPATH, Len(STRPATH) - 1)
End If
Dim SPLITSTRPATH() As String
SPLITSTRPATH = Split(STRPATH, "\")
Dim VAR1 As Integer
Dim MERGE As String
For VAR1 = 0 To UBound(SPLITSTRPATH)
If VAR1 <> 0 Then
MERGE = MERGE & "\"
End If
MERGE = MERGE & SPLITSTRPATH(VAR1)
If Dir(MERGE, vbDirectory) = "" Then
MkDir MERGE
End If
Next
MakeDir = True
Exit Function
End Function
Display More
For step by step execution of this article http://www.accessguru.net//Art…0folder%20using%20VBA.php