Dateisuche mit Platzhalter
31.05.2022 10:09:49
Andy_69
Ich möchte bei meiner Suche ob die Datei vorhanden ist, zusätzlich ein Platzhalter "*" bei der Fz-Nummer im Pfad einbauen, da der Ordner zusätzlich noch Zeichen hinten dran haben kann.
Meine Idee war, ein Stern in folgender Zeile einzubinden, funktioniert aber so nicht:
Pf = Pf & Right(Cells(i, 1), 8) & "*" & "\" 'Fz-Nummer
Ausschnitt aus der Programmierung die Dank Euch auch schon super funktioniert:
...
Dim sPath, Tx, Pf As String
sPath = "\\Glw_04\L.RBA_42\Abteilung\Tfz_E_Lok\E-Lok_Dokumente und Protokolle\" 'Pfad
...
Tx = Format(Cells(i, 4), "yyyy.mm.dd") 'Datum
Tx = Tx & " GN " & Right(Cells(i, 1), 8) 'Fz-Nummer
Tx = Tx & " (" & Cells(i, 2) & ")" 'IH-Stufe aus Liste
Tx = Tx & ".pdf"
Pf = sPath 'Pfad/Glw
Pf = Pf & "BR " & Cells(i, 16) & "\" 'Bauart
Pf = Pf & Right(Cells(i, 1), 8) & "\" 'Fz-Nummer
If Dir(Pf & Tx) "" Then 'Prüfen ob Datei vorhanden
Cells(i, 6) = "ja" 'Datei vorhanden
Cells(i, 5).Value = Date 'Datum setzen
GoTo Ende
Else
Cells(i, 6).Value = "nein" 'Datei nicht vorhanden
End If
...
Vielen Dank für Eure Hilfe
vg Andy