[ggj A listing on a form can be even more helpful if a corresponding graphic is added to the form, as shown in Figure 9.12.
The following code displays the photograph corresponding to the selected employee from the ListBox:
Private Sub lb_EmpName_Change() Dim EmpFound As Range With Range("EmpList")
Set EmpFound = .Find(lb_EmpName.Value) If EmpFound Is Nothing Then
MsgBox ("Employee not found!") lb_EmpName.Value = ""
tb_EmpPosition = .Offset(0, 1) tb_HireDate = .Offset(0, 2) On Error Resume Next Img_Employee.Picture = LoadPicture _ ("C:\Excel VBA 2003 by Jelen & Syrstad\" & EmpFound &
On Error GoTo 0 End With End If
Use a graphic to enhance identification.
Was this article helpful?