ich möchte aus einem Ordner ALLE dateien mit der extension .txt versehen.
wie ist das machbar ?
Jmd ne idee ?
gruß
andreas e
Sub umbenennen_nach_txt()
Dim strFTyp As String, FS As FileSearch, strOrdner As String, _
strSF, strNeuName As String, i As Integer, str1 As String, str2 As String, _
strPfad, z As Integer
strFTyp = ".txt"
If strFTyp = "" Then Exit Sub
strOrdner = InputBox("Ordner:", "Ordner eingeben")
If strOrdner = "" Then Exit Sub
strSF = MsgBox("Mit Unterordnern?", vbYesNo)
Set FS = Application.FileSearch
With FS
.LookIn = strOrdner
.Filename = "*"
If strSF = vbYes Then
.SearchSubFolders = True
Else
.SearchSubFolders = False
End If
If .Execute > 0 Then
For i = 1 To .FoundFiles.Count
For z = Len(.FoundFiles(i)) To 1 Step -1
If Mid(.FoundFiles(i), z, 1) = "\" Then
strPfad = Left(.FoundFiles(i), z)
Exit For
End If
Next z
strNeuName = Left(.FoundFiles(i), Len(.FoundFiles(i)) - 4)
str1 = strNeuName & strFTyp
str2 = .FoundFiles(i)
Name str2 As str1
Next i
End If
End With
End Sub