Dateisuche
René
kann mir jemand bitte helfen.
Möchte mit diesem Code nicht nur nach xlsx sondern auch nach pdf Dateien suchen lassen. Was muss ich da ändern?
Bekomme es alleine nicht hin.
MfG René
Sub Schaltfläche293_Klicken()
Dim strDatei As String, lngZ As Long
Const VERZEICHNIS As String = "O:\Epikrisen_2011\"
If Dir(VERZEICHNIS, vbDirectory) = "" Then
MsgBox VERZEICHNIS & " wurde nicht gefunden!" & Space(10), 64, "weise hin..."
Exit Sub
End If
With ActiveSheet
.Columns(1).ClearContents
strDatei = Dir(VERZEICHNIS & "*" & Cells(3, 3) & "*.xlsx", vbNormal)
If Dir(VERZEICHNIS & "*" & Cells(3, 3) & "*.xlsx", vbNormal) = "" Then
MsgBox ("Für diese Auswahl liegen keine erfassten Epikrisen vor!")
Cells(3, 3).Select
End If
Do While strDatei ""
lngZ = lngZ + 2
.Hyperlinks.Add Anchor:=.Cells(lngZ, 1), _
Address:=VERZEICHNIS & strDatei, SubAddress:="", _
TextToDisplay:=strDatei
strDatei = Dir
Loop
ActiveSheet.Unprotect
Cells(3, 3).Value = ""
Range("C3").Select
With Selection.Interior
.Pattern = xlNone
.TintAndShade = 0
.PatternTintAndShade = 0
Cells(12, 3) = Application.WorksheetFunction.CountA(Range("A1:A1000"))
ActiveSheet.Protect
End With
End With
End Sub