AW: Ordnerstruktur über Tabelle einlesen
13.05.2011 10:50:22
Tino
Hallo,
kannst mal testen, im Code evtl. die Tabelle noch anpassen.
Private Declare Function apiCreateFullPath _
Lib "imagehlp.dll" Alias "MakeSureDirectoryPathExists" _
(ByVal lpPath As String) As Long
Sub Pfad_erzeugen()
Dim ArrayOrdner()
Dim sPath$, sFullPath$, sFolter$
Dim lngRow As Long
With Tabelle1
lngRow = .Cells(Rows.Count, 1).End(xlUp).Row
If lngRow < 3 Then Exit Sub
ArrayOrdner = .Range("A3", .Cells(lngRow, 1)).Resize(, 2).Value2
End With
For lngRow = 1 To Ubound(ArrayOrdner)
If ArrayOrdner(lngRow, 2) <> "" Then
sPath$ = sPath$ & ArrayOrdner(lngRow, 2)
If Right$(sPath$, 1) <> "\" Then sPath$ = sPath$ & "\"
End If
If ArrayOrdner(lngRow, 1) <> "" Then
sFullPath = sPath & ArrayOrdner(lngRow, 1)
If Right$(sFullPath, 1) <> "\" Then sFullPath = sFullPath & "\"
apiCreateFullPath sFullPath
End If
Next lngRow
End Sub
Gruß Tino