AW: Dateiname in String übergeben
10.06.2009 07:55:42
Susanne
Hallo Josef,
habe dein Anweisung eingebaut. Jetzt funktioniert es. War gestern wohl schon betriebsblind! Danke!
Hier der funktionierende Code:
Sub KE30()
Dim strP As String, strP2 As String, strF As String, ii As Integer, strNewFile As _
String, C As Range
strP = "C:\DIVA\GWB\KE30\"
strF = Dir(strP & "*.xls ")
While strF ""
Workbooks.Open strP & strF, False, True
ii = ii + 1
For Each C In Range("A:A")
C.Value = Application.WorksheetFunction.Clean(C.Value)
Next
For Each C In Range("B:B")
C.Value = Application.WorksheetFunction.Clean(C.Value)
Next
For Each C In Range("Y:Y")
C.Value = Application.WorksheetFunction.Clean(C.Value)
Next
Application.DisplayAlerts = False
With ActiveWorkbook
strNewFile = Left(.FullName, InStrRev(.FullName, ".")) & "txt"
.SaveAs strNewFile, FileFormat:=xlText, CreateBackup:=False
.Close False
End With
Application.DisplayAlerts = True
strF = Dir()
Wend
End Sub
LG
Susanne