Gast
#2033968
Hallo an alle,
hab folgenden Code und beim Ausführen kommt der Fehler Laufzeitfehler
1004
kann mir bitte jemand weiterhelfen???
danke
Sub Klima()
currentBook = ActiveWorkbook.Name
Dim myDialog As FileDialog
Set myDialog = Application.FileDialog(msoFileDialogFilePicker)
myDialog.Filters.Add "co2_", "*.txt", 1
cnt = 0
Offset = 5
If myDialog.Show = -1 Then
For Each myitem In myDialog.SelectedItems
openDatei (myitem)
aktDatei = ActiveWorkbook.Name
Range("A15:E2030").Select
Application.CutCopyMode = False
Selection.Copy
Workbooks(currentBook).Activate
reihe = cnt * 2016 + Offset
Cells(reihe, 1).Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone,
SkipBlanks:=False, Transpose:=True
Workbooks(aktDatei).Close
cnt = cnt + 1
Next
Cells(1, 1).Select
End If
End Sub
Sub openDatei(datei)
pos = InStr(1, datei, "co2_", 1)
If pos > 0 Then
Workbooks.OpenText Filename:=datei, Origin _
:=xlMSDOS, StartRow:=1, DataType:=xlDelimited,
TextQualifier:= _
xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True,
Semicolon:=False, _
Comma:=False, Space:=False, Other:=False,
FieldInfo:=Array(Array(1, 1), _
Array(2, 1), Array(3, 1), Array(4, 1), Array(5, 1), Array(6,
1), Array(7, 1), Array(8, 1), _
Array(9, 1), Array(10, 1), Array(11, 1), Array(12, 1),
Array(13, 1), Array(14, 1), Array(15 _
, 1), Array(16, 1), Array(17, 1), Array(18, 1), Array(19,
1), Array(20, 1), Array(21, 1), _
Array(22, 1), Array(23, 1), Array(24, 1), Array(25, 1),
Array(26, 1), Array(27, 1), Array( _
28, 1), Array(29, 1), Array(30, 1), Array(31, 1), Array(32,
1), Array(33, 1), Array(34, 1), _
Array(35, 1), Array(36, 1)), DecimalSeparator:=".",
ThousandsSeparator:=",", _
TrailingMinusNumbers:=True
End If
End Sub