MUSASHI
11-02-2004, 12:52 PM
I have an employee list, named range "emplist". To view an employee I call a userform, it has a list box with various employee names....when I select employee I get the caption data, as well as a frame for a pic....I cant get the pic to show up...I been messing with this for a over an hour...shrugs
what the heck am I doing wrong...big things first, then little things..hah
:bore
Private Sub ListBox1_Click()
Dim EmpFound As Range
With Range("EmpList")
Set EmpFound = .Find(ListBox1.Value)
If EmpFound Is Nothing Then
Label1.Caption = ""
Else
With EmpFound
Label1.Caption = "LastName: " & .Value & vbLf & _
"FirstName: " & .Offset(, 1).Value & vbLf & _
"Position: " & .Offset(, 2).Value & vbLf & _
"Hired: " & .Offset(, 11).Value & vbLf & _
"DOB: " & .Offset(, 9).Value & vbLf & _
"SS#: " & .Offset(, 10).Value & vbLf & _
"Employee#: " & .Offset(, 13).Value & vbLf & _
"Phone: " & .Offset(, 7).Value
On Error Resume Next
Img_Employee.Picture = LoadPicture _
("C:\Documents and Settings\Dunlap\excelprojects\" & EmpFound & ".bmp")
On Error GoTo 0
End With
End If
End With
End Sub
the basic code came form Mr.Excel file...I added additional list items etc.
Thx!
what the heck am I doing wrong...big things first, then little things..hah
:bore
Private Sub ListBox1_Click()
Dim EmpFound As Range
With Range("EmpList")
Set EmpFound = .Find(ListBox1.Value)
If EmpFound Is Nothing Then
Label1.Caption = ""
Else
With EmpFound
Label1.Caption = "LastName: " & .Value & vbLf & _
"FirstName: " & .Offset(, 1).Value & vbLf & _
"Position: " & .Offset(, 2).Value & vbLf & _
"Hired: " & .Offset(, 11).Value & vbLf & _
"DOB: " & .Offset(, 9).Value & vbLf & _
"SS#: " & .Offset(, 10).Value & vbLf & _
"Employee#: " & .Offset(, 13).Value & vbLf & _
"Phone: " & .Offset(, 7).Value
On Error Resume Next
Img_Employee.Picture = LoadPicture _
("C:\Documents and Settings\Dunlap\excelprojects\" & EmpFound & ".bmp")
On Error GoTo 0
End With
End If
End With
End Sub
the basic code came form Mr.Excel file...I added additional list items etc.
Thx!