Gruppe
Dialog
Bereich
ComboBox
Thema
Dateinamen in UserForm-ComboBox einlesen und Datei öffnen
Problem
Die Werte aus Spalte A sollen in eine UserForm-ComboBox eingelesen werden.
Lösung
Die in der ComboBox ausgewählte, durch einen Hyperlink verbundene Datei soll auf Schaltflächendruck zu öffnen sein.
StandardModule: Modul1
Sub CallForm()
frmHype.Show
End Sub
ClassModule: frmHype
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub cmdOK_Click()
Application.ScreenUpdating = False
Application.EnableEvents = False
On Error GoTo ERRORHANDLER
Cells(cboFiles.ListIndex + 1, 1).Hyperlinks(1).Follow
ERRORHANDLER:
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub
Private Sub UserForm_Initialize()
Dim iRow As Integer
iRow = 1
Do Until IsEmpty(Cells(iRow, 1))
cboFiles.AddItem Cells(iRow, 1)
iRow = iRow + 1
Loop
cboFiles.ListIndex = 0
End Sub