Für Eure Hilfe bedanke ich mich im Voraus.
Viele Grüße
Claus
Sub Bild()
Dim strSuche$, rngFind As Range, strPathBild$, strSucheDatei$
Const strPath$ = "c:\temp\"
strSuche = "a"
' InputBox("Bitte Suchbegriff eingeben!", "Suche")
strSucheDatei = "Bild"
If StrPtr(strSuche) = 0 Then Exit Sub
With Tabelle1
.Image1.Visible = False
Set rngFind = .UsedRange.Find(What:=strSuche, LookIn:=xlValues, LookAt _
:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False)
If Not rngFind Is Nothing Then
strPathBild = strPath & strSucheDatei & ".jpg"
If Dir(strPathBild, vbNormal) "" Then
With .Image1
.Picture = LoadPicture(strPathBild)
.Left = rngFind.Left + rngFind.Width * 0.7
.Top = rngFind.Top + rngFind.Height * -1.4
.Visible = True
End With
Else
.Image1.Picture = LoadPicture("")
MsgBox "'" & strPathBild & "'" & vbCr & "Datei wurde nicht gefunden!", _
vbExclamation
End If
Else
MsgBox "'" & strSucheDatei & "' wurde nicht gefunden!", vbExclamation
End If
End With
End Sub