Gruppe
Dialog
Problem
Über eine UserForm sollen Suchbegriffe eingegeben und eine Suche gestartet werden. War die Suche erfolgreich, ist das Suchergebnis in Tabelle2 einzutragen. Existiert ein Hyperlink, ist das zugehörige Bild einzufügen.
ClassModule: frmInsertPicture
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub cmdOK_Click()
Dim pct As Picture
Dim rng As Range
Set rng = Cells.Find(TextBox1.Text, LookIn:=xlValues, lookat:=xlWhole)
If rng Is Nothing Then
Beep
MsgBox "Suchbegriff wurde nicht gefunden!"
End
End If
With Worksheets("Tabelle2")
.Select
.Range("B1").Select
.Range("A1").Value = rng.Value
If Dir(rng.Hyperlinks(1).Address) <> "" Then
Set pct = .Pictures.Insert(rng.Hyperlinks(1).Address)
End If
End With
Unload Me
End Sub
StandardModule: basMain
Sub CallForm()
frmInsertPicture.Show
End Sub