Hallo Zusammen,
ich brauche dringend Hilfe. Kann mir bitte jemand helfen bin absoluter VBA Anfänger :(
Ich habe den folgenden VBA Code gefunden zum Thema aus CSV Dateien XLS Dateien machen. Der Code funktioniert auch wunderbar.
Jedoch möchte ich, dass die Bezeichnung der neuen XLS Datei immer "Hallo" lautet. Wo muss ich was ändern?
Sub aaaaa()
Dim sFile As String, sPath As String, iFree As Integer
Dim arrCSV, arrTmp, arrXLS(), i As Long, j As Integer, n As Long
sPath = "c:\temp\" 'anpassen
sFile = Dir(sPath & "*.csv")
Application.ScreenUpdating = False
Do While Len(sFile)
iFree = FreeFile
Open sPath & sFile For Input As iFree
arrCSV = Split(Input(LOF(iFree), iFree), vbCrLf)
Close iFree
For i = 0 To UBound(arrCSV)
arrTmp = Split(arrCSV(i), ";")
n = Application.Max(n, UBound(arrTmp))
Next
ReDim arrXLS(1 To UBound(arrCSV) + 1, 1 To n + 1)
For i = 0 To UBound(arrCSV)
arrTmp = Split(arrCSV(i), ";")
For j = 0 To UBound(arrTmp)
arrXLS(i + 1, j + 1) = arrTmp(j)
Next
Next
With Workbooks.Add
.Sheets(1).Cells(1, 1).Resize(UBound(arrXLS), UBound(arrXLS, 2)) = arrXLS
.SaveAs sPath & Mid(sFile, 1, Len(sFile) - 4)
.Close
End With
sFile = Dir
Loop
End Sub |