I am using the following vba code to create an folder structure with the data of the excel sheet:
Option Explicit
Declare Function MakePath& Lib "imagehlp.dll" Alias _
"MakeSureDirectoryPathExists" (ByVal sPath$)
Sub CreatePaths()
Dim i&
With Tabelle1
For i = 1 To .Cells(.Rows.Count, "E").End(xlUp).Row
MakePath .Cells(i, "E").Text
Next
End With
End Sub
"C:\Users\xxxxx\Desktop\test\H01\U01\UU01"
Each row is created as a folder structure in my chosen folder, until here it does what i need to. Column E adds column A-D and separates it with a backslash. Now i need to add for example 4 folders (A,B,C,D) in each folder of the column 'E' and i tried to add it but it does not work. What do i have to add to my vba code so the folders are created?
"C:\Users\xxxxx\Desktop\test\H01\U01\UU01"
unless"C:\Users\xxxxx\Desktop\test\H01\U01"
exists. You need to work through the path, level by level and where each level doesn't exist, create it. – CLRmake_directory()
sub! – CLR