Sub
getDatei()
Dim
wkb
As
Excel.Workbook
Dim
varFile
As
Variant
Dim
intDatei
As
Integer
varFile = Application.GetOpenFilename(, ,
"Wählen Sie bitte die zu konvertierenden Dateien aus."
, ,
True
)
If
TypeName(varFile)
Like
"Boolean"
Then
MsgBox
"Keine Datei ausgewählt!"
, vbInformation
Exit
Sub
Else
For
intDatei = 1
To
UBound(varFile)
Application.Workbooks.Open (varFile(intDatei)), Local:=
True
Set
wkb = ActiveWorkbook
wkb.Sheets(1).Cells.Copy Destination:=ThisWorkbook.Sheets(1).Range(
"A1"
)
Application.DisplayAlerts =
False
ThisWorkbook.Sheets(1).SaveAs Filename:=Environ(
"UserProfile"
) &
"\Desktop\" & intDatei & "
.csv", FileFormat:=Excel.xlCSV, Local:=
True
Application.DisplayAlerts =
True
wkb.Close
True
Next
intDatei
Set
wkb =
Nothing
MsgBox (
"ASCII Umwandlung abgeschlossen, Dateien wurden abgesichert."
)
End
If
End
Sub