AW: Umbenennen von Windows-Ordnern aus VBA
07.04.2009 14:32:29
Windows-Ordnern
Hallo,
Sub tt()
Dim fs As Object, oF As Object, oSF As Object, vntFS(), n As Integer
Const strPfad As String = "n:\Test"
Set fs = CreateObject("scripting.filesystemobject")
Set oF = fs.getfolder(strPfad)
ReDim vntFS(1 To oF.subfolders.Count)
For Each oSF In oF.subfolders
n = n + 1
vntFS(n) = oSF.Name
Next
QuickSort vntFS
Name strPfad & "\" & vntFS(1) As strPfad & "\" & "MeinNeuerOrdnerName"
End Sub
Sub QuickSort(ByRef VA_Array, Optional V_Low1, Optional V_High1)
On Error Resume Next
Dim V_Low2 As Long, V_High2 As Long
Dim V_Val1, V_Val2 As Variant
If IsMissing(V_Low1) Then
V_Low1 = LBound(VA_Array, 1)
End If
If IsMissing(V_High1) Then
V_High1 = UBound(VA_Array, 1)
End If
V_Low2 = V_Low1
V_High2 = V_High1
V_Val1 = VA_Array((V_Low1 + V_High1) / 2)
While (V_Low2 V_Val1 And _
V_High2 > V_Low1)
V_High2 = V_High2 - 1
Wend
If (V_Low2 V_Low1) Then Call _
QuickSort(VA_Array, V_Low1, V_High2)
If (V_Low2
Gruß
Dierk