Gruppe
Dialog
Problem
Über eine UserForm sollen TextBox-Inhalte zusammen mit Hyperlinks zu auszuwählenden Grafiken in das Tabellenblatt übernommen werden.
ClassModule: frmHyperLink
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub cmdOK_Click()
Dim iCounter As Integer
Dim sTag As String
Rows(1).Clear
For iCounter = 1 To 3
sTag = Controls("CommandButton" & iCounter).Tag
Cells(1, iCounter).Value = Controls("TextBox" & iCounter).Text
If sTag <> "False" And sTag <> "" Then
ActiveSheet.Hyperlinks.Add _
Anchor:=Cells(1, iCounter), _
Address:=sTag
End If
Next iCounter
Unload Me
End Sub
Private Sub CommandButton1_Click()
CommandButton1.Tag = SelectPicture
End Sub
Private Sub CommandButton2_Click()
CommandButton2.Tag = SelectPicture
End Sub
Private Sub CommandButton3_Click()
CommandButton3.Tag = SelectPicture
End Sub
Private Function SelectPicture()
Dim var As Variant
var = Application.GetOpenFilename("Bild-Dateien (*.gif), *.gif")
If var = False Then
SelectPicture = "False"
Else
SelectPicture = var
End If
End Function
StandardModule: Modul1
Sub CallForm()
frmHyperLink.Show
End Sub