-
Hello busy beez
Can anyone rectify this problem... how to create a folder within a folder at the same instruction.. ie:
c:\folder1\folder2
my code so far
Private Sub CreateFolders_Click()
If Dir(Products.text, vbDirectory) = Products.text Then
MsgBox "Already exists"
Else
MkDir "c:\" + Products.text + ??????????
End If
End Sub
Regards
-
Sub Directory
I don't think you can create sub directories under non-existent directories. You have to build the path one directory at a time and work your way down. Maybe something like this would work for you:
If Len(Dir$(products.text, vbDirectory)) <= 0 Then
Dim Fpath As String
Dim Branches() As String
Dim b As Integer
Branches = Split(products.text, "\")
For b = LBound(Branches) To UBound(Branches)
Fpath = Fpath & Branches(b) & "\"
If Len(Dir$(Fpath, vbDirectory)) <= 0 Then
MkDir Fpath
End If
Next b
End If