|
-
Apr 27th, 2000, 09:54 PM
#1
Thread Starter
Hyperactive Member
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
-
Apr 27th, 2000, 10:48 PM
#2
Lively Member
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|