Quantcast
Channel: VBForums - CodeBank - Visual Basic 6 and earlier
Viewing all articles
Browse latest Browse all 1508

How to create folder and subfolder structure using list in excel

$
0
0
Hi, I Have searched high and low and still getting nowhere. have a file structure ...e.g c:\client files\abc\data\held and c:\clientfiles\abc\data\used etc and I wish to use the structure to create a whole directory for all a list of cells as in abc above.

I have basic visual basic knowledge but cannot get the mk dir script to work in creating folders and subfolders for a specific list.

This is what have so far


Sub CreateDirs()
Dim R As Range
Dim RootFolder As String
RootFolder = "C:\Client Files"
For Each R In Range("B1:B4")
If Len(R.Text) > 0 Then
On Error Resume Next
MkDir RootFolder & "\" & R.Text
MkDir RootFolder & "\" & R.Text & "\Blue File"
MkDir RootFolder & "\" & R.Text & "\Orange File"
MkDir RootFolder & "\" & R.Text & "\Archive"
On Error GoTo 0
End If
Next R
End Sub
But I would like to create also a subfolder folder within the \Blue File folder.

Thanks for any help

Hullio

Viewing all articles
Browse latest Browse all 1508

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>