Hallo zusammen,
Ich habe ein problem und bräuchte hilfe. Kennen mich auch noch nicht so gut aus in Makro.
Mein problem ist, dass mein Makro noch bis For Each fDat In fDir geht aber danach gleich zu meiner zweite If-Schleife geht.
Kann mir jemand sagen woran das liegt? Denn die Datei die ich suche existiert ja
Danke
Set fCheckInDat = Nothing
For Each fDat In fDir
If InStr(fDat.Name, .Cells(intZeile, 5)) = 1 And (InStr(fDat.Name, "CheckIn.txt") > 0 Or InStr(fDat.Name, "ChekOut.txt") > 0) Then
Set fCheckInDat = fDat
Exit For
End If
Next fDat
If fCheckInDat Is Nothing Then
MsgBox ("Keine " & .Cells(intZeile, 5) & "_*_CheckIn.txt oder " & .Cells(intZeile, 5) & "_*_CheckOut.txt Datei in " & Pfad & " gefunden!")
Exit Sub
End If
|