Hallo, ich versuche mich gerade an folgender Aufgabenstellung: Alle .csv Datein eines ausgewaehlten Ordners oeffnen und dann das dann nach XXXProgramXXstartsXXXX startende Programm abspulen fuer jede Datei. Danach die Datein nicht schliessen oder speichern. Leider bekomme ich keinen runtime error (1004). Hat jemand eine Idee? Meine VBA-Kenntnisse sind leider noch sehr uebersichtlich. Vielen Dank!
<div>
Sub
LoopAllExcelFilesInFolder()</div><div>
</div><div>
Dim
wb
As
Workbook</div><div>
Dim
myPath
As
String
</div><div>
Dim
myFile
As
String
</div><div>
Dim
myExtension
As
String
</div><div>
Dim
FldrPicker
As
FileDialog</div><div>
</div><div>
</div><div>
</div><div>
With
FldrPicker</div><div> .Title =
"Select A Target Folder"
</div><div> .AllowMultiSelect =
False
</div><div>
If
.Show <> -1
Then
GoTo
NextCode</div><div> myPath = .SelectedItems(1) & "\"</div><div>
End
With
</div><div>
</div><div>
</div><div>
</div><div>
</div><div>
</div><div>i = 0</div><div>j = 0</div><div>
</div><div> Columns(
"A:A"
).
Select
</div><div> Application.CutCopyMode =
False
</div><div> Selection.TextToColumns Destination:=Range(
"A1"
), DataType:=xlDelimited, _</div><div> TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=
False
, Tab:=
True
, _</div><div> Semicolon:=
True
, Comma:=
False
, Space:=
False
, Other:=
False
, FieldInfo _</div><div> :=Array(Array(1, 1), Array(2, 1)), TrailingMinusNumbers:=
True
</div><div>
</div><div>
For
i = 19
To
522</div><div>
</div><div>
</div><div>
</div><div>
If
Cells(i, 4).Value >= Cells(i, 5).Value
And
Cells(i, 4).Value <= Cells(i, 6).Value
Or
Cells(i, 4).Value =
"0"
Or
Cells(i, 7).Value =
"-"
Or
Cells(i, 7).Value =
"mm"
Or
Cells(i, 4).Value =
"Value"
Or
Cells(i, 7).Value =
"mbar"
Or
Cells(i, 7).Value =
"Grad"
Or
Cells(i, 7).Value =
"ccm/min"
Or
Cells(i, 6).Value =
""
Or
Cells(i, 5).Value =
""
Or
Cells(i, 2).Value =
"OP1200OS"
Or
Cells(i, 2).Value =
"OP1200CS"
Then
</div><div>
</div><div>
</div><div>
</div><div>
</div><div>ResetSettings:</div><div>
</div><div>
End
Sub
</div><div>
</div>