+ Reply to Thread
Results 1 to 11 of 11

Userform Image

  1. #1
    Jennifer
    Guest

    Userform Image

    HELP! First time trying this, I am try an example out of a book. I'm stuck.
    Do I need to have anything in the Userform Initilize?

    Trying to type Employee name and their picture show up in the userform.
    Thank you. Jennifer

    Private Sub tb_EmpName_Change()
    Dim EmpFound As Range
    With Range("EmpList")
    Set EmpFound = .Find(tb_EmpName.Value)
    If EmpFound Is Nothing Then
    MsgBox ("Employee Not Found!")
    tb_EmpName.Value = ""
    Me.tb_EmpName.SetFocus
    Exit Sub
    Else
    With Range(EmpFound.Address)
    tb_EmpPosition = .Offset(0, 1)
    tb_EmpHireDate = .Offset(0, 2)
    On Error Resume Next
    Img_Employee.Picture = LoadPicture( _
    "C:\Excel VBA 2003\" & EmpFound & ".jpg")
    On Error GoTo 0
    End With
    End If
    End With
    End Sub
    --
    Though daily learning, I LOVE EXCEL!
    Jennifer

  2. #2
    Bob Phillips
    Guest

    Re: Userform Image

    Jennifer,

    One of the problems is using the Change event, as this fires on every letter
    typed into the textbox. For instance, if you have Bianca, Bill and Bob in
    the list, as soon as you type B it loads the first it finds. However, on
    typing the second letter, it will do a more accurate match, Bi would then
    find Bill, and reload with the new image.

    Although that might be a bit annoying, you should al end up okay, except of
    course if you try to enter Brian, where it will error on the Br, but an
    image is already loaded.

    What are you experiencing?

    --

    HTH

    Bob Phillips

    (remove nothere from the email address if mailing direct)

    "Jennifer" <[email protected]> wrote in message
    news:[email protected]...
    > HELP! First time trying this, I am try an example out of a book. I'm

    stuck.
    > Do I need to have anything in the Userform Initilize?
    >
    > Trying to type Employee name and their picture show up in the userform.
    > Thank you. Jennifer
    >
    > Private Sub tb_EmpName_Change()
    > Dim EmpFound As Range
    > With Range("EmpList")
    > Set EmpFound = .Find(tb_EmpName.Value)
    > If EmpFound Is Nothing Then
    > MsgBox ("Employee Not Found!")
    > tb_EmpName.Value = ""
    > Me.tb_EmpName.SetFocus
    > Exit Sub
    > Else
    > With Range(EmpFound.Address)
    > tb_EmpPosition = .Offset(0, 1)
    > tb_EmpHireDate = .Offset(0, 2)
    > On Error Resume Next
    > Img_Employee.Picture = LoadPicture( _
    > "C:\Excel VBA 2003\" & EmpFound & ".jpg")
    > On Error GoTo 0
    > End With
    > End If
    > End With
    > End Sub
    > --
    > Though daily learning, I LOVE EXCEL!
    > Jennifer




  3. #3
    Jennifer
    Guest

    Re: Userform Image

    Hi Bob,
    Thank you!
    It is giving me the yellow highlight in this area

    Img_Employee.Picture = LoadPicture( _
    "C:\Excel VBA 2003\" & EmpFound & ".jpg")

    To make sure I am understanding what is written & correct:
    Img_Employee <> This is the Image name on the form
    C:\Excel VBA 2003 <>This is the route to the file
    ..jpg <> Picture will need to be in jpg format
    --
    Though daily learning, I LOVE EXCEL!
    Jennifer


    "Bob Phillips" wrote:

    > Jennifer,
    >
    > One of the problems is using the Change event, as this fires on every letter
    > typed into the textbox. For instance, if you have Bianca, Bill and Bob in
    > the list, as soon as you type B it loads the first it finds. However, on
    > typing the second letter, it will do a more accurate match, Bi would then
    > find Bill, and reload with the new image.
    >
    > Although that might be a bit annoying, you should al end up okay, except of
    > course if you try to enter Brian, where it will error on the Br, but an
    > image is already loaded.
    >
    > What are you experiencing?
    >
    > --
    >
    > HTH
    >
    > Bob Phillips
    >
    > (remove nothere from the email address if mailing direct)
    >
    > "Jennifer" <[email protected]> wrote in message
    > news:[email protected]...
    > > HELP! First time trying this, I am try an example out of a book. I'm

    > stuck.
    > > Do I need to have anything in the Userform Initilize?
    > >
    > > Trying to type Employee name and their picture show up in the userform.
    > > Thank you. Jennifer
    > >
    > > Private Sub tb_EmpName_Change()
    > > Dim EmpFound As Range
    > > With Range("EmpList")
    > > Set EmpFound = .Find(tb_EmpName.Value)
    > > If EmpFound Is Nothing Then
    > > MsgBox ("Employee Not Found!")
    > > tb_EmpName.Value = ""
    > > Me.tb_EmpName.SetFocus
    > > Exit Sub
    > > Else
    > > With Range(EmpFound.Address)
    > > tb_EmpPosition = .Offset(0, 1)
    > > tb_EmpHireDate = .Offset(0, 2)
    > > On Error Resume Next
    > > Img_Employee.Picture = LoadPicture( _
    > > "C:\Excel VBA 2003\" & EmpFound & ".jpg")
    > > On Error GoTo 0
    > > End With
    > > End If
    > > End With
    > > End Sub
    > > --
    > > Though daily learning, I LOVE EXCEL!
    > > Jennifer

    >
    >
    >


  4. #4
    Bob Phillips
    Guest

    Re: Userform Image

    Hi Jennifer,

    That is odd because it is surrounded by am On Error. Do you get that when
    you try to run it, or after typing something in the textbox.

    Img_Employee is the name of an image control on the userform, you have added
    one?

    "C:\Excel VBA 2003\" & EmpFound & ".jpg" is the name of the actual JPG file,
    and it picks up the value from your employee list and appends that to the
    path. If the files are GIF files, change the .jpg to .gif, but that cannot
    be the error as the code works nicely for me even if the jpg doesn't exist
    (doesn't display it of course).

    --
    HTH

    Bob Phillips

    (remove nothere from email address if mailing direct)

    "Jennifer" <[email protected]> wrote in message
    news:[email protected]...
    > Hi Bob,
    > Thank you!
    > It is giving me the yellow highlight in this area
    >
    > Img_Employee.Picture = LoadPicture( _
    > "C:\Excel VBA 2003\" & EmpFound & ".jpg")
    >
    > To make sure I am understanding what is written & correct:
    > Img_Employee <> This is the Image name on the form
    > C:\Excel VBA 2003 <>This is the route to the file
    > .jpg <> Picture will need to be in jpg format
    > --
    > Though daily learning, I LOVE EXCEL!
    > Jennifer
    >
    >
    > "Bob Phillips" wrote:
    >
    > > Jennifer,
    > >
    > > One of the problems is using the Change event, as this fires on every

    letter
    > > typed into the textbox. For instance, if you have Bianca, Bill and Bob

    in
    > > the list, as soon as you type B it loads the first it finds. However, on
    > > typing the second letter, it will do a more accurate match, Bi would

    then
    > > find Bill, and reload with the new image.
    > >
    > > Although that might be a bit annoying, you should al end up okay, except

    of
    > > course if you try to enter Brian, where it will error on the Br, but an
    > > image is already loaded.
    > >
    > > What are you experiencing?
    > >
    > > --
    > >
    > > HTH
    > >
    > > Bob Phillips
    > >
    > > (remove nothere from the email address if mailing direct)
    > >
    > > "Jennifer" <[email protected]> wrote in message
    > > news:[email protected]...
    > > > HELP! First time trying this, I am try an example out of a book. I'm

    > > stuck.
    > > > Do I need to have anything in the Userform Initilize?
    > > >
    > > > Trying to type Employee name and their picture show up in the

    userform.
    > > > Thank you. Jennifer
    > > >
    > > > Private Sub tb_EmpName_Change()
    > > > Dim EmpFound As Range
    > > > With Range("EmpList")
    > > > Set EmpFound = .Find(tb_EmpName.Value)
    > > > If EmpFound Is Nothing Then
    > > > MsgBox ("Employee Not Found!")
    > > > tb_EmpName.Value = ""
    > > > Me.tb_EmpName.SetFocus
    > > > Exit Sub
    > > > Else
    > > > With Range(EmpFound.Address)
    > > > tb_EmpPosition = .Offset(0, 1)
    > > > tb_EmpHireDate = .Offset(0, 2)
    > > > On Error Resume Next
    > > > Img_Employee.Picture = LoadPicture( _
    > > > "C:\Excel VBA 2003\" & EmpFound & ".jpg")
    > > > On Error GoTo 0
    > > > End With
    > > > End If
    > > > End With
    > > > End Sub
    > > > --
    > > > Though daily learning, I LOVE EXCEL!
    > > > Jennifer

    > >
    > >
    > >




  5. #5
    Jennifer
    Guest

    Re: Userform Image

    Yeah Bob,
    I get the error when I type the first letter of the employees name. Have any
    ideas? Thank you for your time.
    --
    Though daily learning, I LOVE EXCEL!
    Jennifer


    "Bob Phillips" wrote:

    > Hi Jennifer,
    >
    > That is odd because it is surrounded by am On Error. Do you get that when
    > you try to run it, or after typing something in the textbox.
    >
    > Img_Employee is the name of an image control on the userform, you have added
    > one?
    >
    > "C:\Excel VBA 2003\" & EmpFound & ".jpg" is the name of the actual JPG file,
    > and it picks up the value from your employee list and appends that to the
    > path. If the files are GIF files, change the .jpg to .gif, but that cannot
    > be the error as the code works nicely for me even if the jpg doesn't exist
    > (doesn't display it of course).
    >
    > --
    > HTH
    >
    > Bob Phillips
    >
    > (remove nothere from email address if mailing direct)
    >
    > "Jennifer" <[email protected]> wrote in message
    > news:[email protected]...
    > > Hi Bob,
    > > Thank you!
    > > It is giving me the yellow highlight in this area
    > >
    > > Img_Employee.Picture = LoadPicture( _
    > > "C:\Excel VBA 2003\" & EmpFound & ".jpg")
    > >
    > > To make sure I am understanding what is written & correct:
    > > Img_Employee <> This is the Image name on the form
    > > C:\Excel VBA 2003 <>This is the route to the file
    > > .jpg <> Picture will need to be in jpg format
    > > --
    > > Though daily learning, I LOVE EXCEL!
    > > Jennifer
    > >
    > >
    > > "Bob Phillips" wrote:
    > >
    > > > Jennifer,
    > > >
    > > > One of the problems is using the Change event, as this fires on every

    > letter
    > > > typed into the textbox. For instance, if you have Bianca, Bill and Bob

    > in
    > > > the list, as soon as you type B it loads the first it finds. However, on
    > > > typing the second letter, it will do a more accurate match, Bi would

    > then
    > > > find Bill, and reload with the new image.
    > > >
    > > > Although that might be a bit annoying, you should al end up okay, except

    > of
    > > > course if you try to enter Brian, where it will error on the Br, but an
    > > > image is already loaded.
    > > >
    > > > What are you experiencing?
    > > >
    > > > --
    > > >
    > > > HTH
    > > >
    > > > Bob Phillips
    > > >
    > > > (remove nothere from the email address if mailing direct)
    > > >
    > > > "Jennifer" <[email protected]> wrote in message
    > > > news:[email protected]...
    > > > > HELP! First time trying this, I am try an example out of a book. I'm
    > > > stuck.
    > > > > Do I need to have anything in the Userform Initilize?
    > > > >
    > > > > Trying to type Employee name and their picture show up in the

    > userform.
    > > > > Thank you. Jennifer
    > > > >
    > > > > Private Sub tb_EmpName_Change()
    > > > > Dim EmpFound As Range
    > > > > With Range("EmpList")
    > > > > Set EmpFound = .Find(tb_EmpName.Value)
    > > > > If EmpFound Is Nothing Then
    > > > > MsgBox ("Employee Not Found!")
    > > > > tb_EmpName.Value = ""
    > > > > Me.tb_EmpName.SetFocus
    > > > > Exit Sub
    > > > > Else
    > > > > With Range(EmpFound.Address)
    > > > > tb_EmpPosition = .Offset(0, 1)
    > > > > tb_EmpHireDate = .Offset(0, 2)
    > > > > On Error Resume Next
    > > > > Img_Employee.Picture = LoadPicture( _
    > > > > "C:\Excel VBA 2003\" & EmpFound & ".jpg")
    > > > > On Error GoTo 0
    > > > > End With
    > > > > End If
    > > > > End With
    > > > > End Sub
    > > > > --
    > > > > Though daily learning, I LOVE EXCEL!
    > > > > Jennifer
    > > >
    > > >
    > > >

    >
    >
    >


  6. #6
    Jennifer
    Guest

    RE: Userform Image

    Hey Bob,
    I did go ahead and change Private Sub tb_EmpName_Change() to Private Sub
    tb_EmpName_Click()

    Now when I hit tab or enter it doesn't fill the image box it just goes to
    the next text box. When I switch it back to <tb_EmpName_Change> I get the
    problems I was having before
    --
    Though daily learning, I LOVE EXCEL!
    Jennifer


    "Jennifer" wrote:

    > HELP! First time trying this, I am try an example out of a book. I'm stuck.
    > Do I need to have anything in the Userform Initilize?
    >
    > Trying to type Employee name and their picture show up in the userform.
    > Thank you. Jennifer
    >
    > Private Sub tb_EmpName_Change()
    > Dim EmpFound As Range
    > With Range("EmpList")
    > Set EmpFound = .Find(tb_EmpName.Value)
    > If EmpFound Is Nothing Then
    > MsgBox ("Employee Not Found!")
    > tb_EmpName.Value = ""
    > Me.tb_EmpName.SetFocus
    > Exit Sub
    > Else
    > With Range(EmpFound.Address)
    > tb_EmpPosition = .Offset(0, 1)
    > tb_EmpHireDate = .Offset(0, 2)
    > On Error Resume Next
    > Img_Employee.Picture = LoadPicture( _
    > "C:\Excel VBA 2003\" & EmpFound & ".jpg")
    > On Error GoTo 0
    > End With
    > End If
    > End With
    > End Sub
    > --
    > Though daily learning, I LOVE EXCEL!
    > Jennifer


  7. #7
    Bob Phillips
    Guest

    Re: Userform Image

    Jennifer,

    I cannot re-create the problem. Can you mail me the workbook?

    --

    HTH

    Bob Phillips

    (remove nothere from the email address if mailing direct)

    "Jennifer" <[email protected]> wrote in message
    news:[email protected]...
    > Hey Bob,
    > I did go ahead and change Private Sub tb_EmpName_Change() to Private Sub
    > tb_EmpName_Click()
    >
    > Now when I hit tab or enter it doesn't fill the image box it just goes to
    > the next text box. When I switch it back to <tb_EmpName_Change> I get the
    > problems I was having before
    > --
    > Though daily learning, I LOVE EXCEL!
    > Jennifer
    >
    >
    > "Jennifer" wrote:
    >
    > > HELP! First time trying this, I am try an example out of a book. I'm

    stuck.
    > > Do I need to have anything in the Userform Initilize?
    > >
    > > Trying to type Employee name and their picture show up in the userform.
    > > Thank you. Jennifer
    > >
    > > Private Sub tb_EmpName_Change()
    > > Dim EmpFound As Range
    > > With Range("EmpList")
    > > Set EmpFound = .Find(tb_EmpName.Value)
    > > If EmpFound Is Nothing Then
    > > MsgBox ("Employee Not Found!")
    > > tb_EmpName.Value = ""
    > > Me.tb_EmpName.SetFocus
    > > Exit Sub
    > > Else
    > > With Range(EmpFound.Address)
    > > tb_EmpPosition = .Offset(0, 1)
    > > tb_EmpHireDate = .Offset(0, 2)
    > > On Error Resume Next
    > > Img_Employee.Picture = LoadPicture( _
    > > "C:\Excel VBA 2003\" & EmpFound & ".jpg")
    > > On Error GoTo 0
    > > End With
    > > End If
    > > End With
    > > End Sub
    > > --
    > > Though daily learning, I LOVE EXCEL!
    > > Jennifer




  8. #8
    Jennifer
    Guest

    Re: Userform Image

    Bob,
    I tried to email you using the email address you have in your profile and
    received a message back saying it can't be delivered. What address you like
    me to use? Thank you, Bob. Jennifer
    --
    Though daily learning, I LOVE EXCEL!
    Jennifer


    "Bob Phillips" wrote:

    > Jennifer,
    >
    > I cannot re-create the problem. Can you mail me the workbook?
    >
    > --
    >
    > HTH
    >
    > Bob Phillips
    >
    > (remove nothere from the email address if mailing direct)
    >
    > "Jennifer" <[email protected]> wrote in message
    > news:[email protected]...
    > > Hey Bob,
    > > I did go ahead and change Private Sub tb_EmpName_Change() to Private Sub
    > > tb_EmpName_Click()
    > >
    > > Now when I hit tab or enter it doesn't fill the image box it just goes to
    > > the next text box. When I switch it back to <tb_EmpName_Change> I get the
    > > problems I was having before
    > > --
    > > Though daily learning, I LOVE EXCEL!
    > > Jennifer
    > >
    > >
    > > "Jennifer" wrote:
    > >
    > > > HELP! First time trying this, I am try an example out of a book. I'm

    > stuck.
    > > > Do I need to have anything in the Userform Initilize?
    > > >
    > > > Trying to type Employee name and their picture show up in the userform.
    > > > Thank you. Jennifer
    > > >
    > > > Private Sub tb_EmpName_Change()
    > > > Dim EmpFound As Range
    > > > With Range("EmpList")
    > > > Set EmpFound = .Find(tb_EmpName.Value)
    > > > If EmpFound Is Nothing Then
    > > > MsgBox ("Employee Not Found!")
    > > > tb_EmpName.Value = ""
    > > > Me.tb_EmpName.SetFocus
    > > > Exit Sub
    > > > Else
    > > > With Range(EmpFound.Address)
    > > > tb_EmpPosition = .Offset(0, 1)
    > > > tb_EmpHireDate = .Offset(0, 2)
    > > > On Error Resume Next
    > > > Img_Employee.Picture = LoadPicture( _
    > > > "C:\Excel VBA 2003\" & EmpFound & ".jpg")
    > > > On Error GoTo 0
    > > > End With
    > > > End If
    > > > End With
    > > > End Sub
    > > > --
    > > > Though daily learning, I LOVE EXCEL!
    > > > Jennifer

    >
    >
    >


  9. #9
    Art H
    Guest

    Re: Userform Image

    Just an uninformed guess: Is it legal to form a string using an object
    ("Dim EmpFound As Range" and <"C:\Excel VBA 2003\" & EmpFound &
    ".jpg">)?

    Art

    Jennifer wrote:
    > Yeah Bob,
    > I get the error when I type the first letter of the employees name. Have any
    > ideas? Thank you for your time.
    > --
    > Though daily learning, I LOVE EXCEL!
    > Jennifer
    >
    >
    > "Bob Phillips" wrote:
    >
    > > Hi Jennifer,
    > >
    > > That is odd because it is surrounded by am On Error. Do you get that when
    > > you try to run it, or after typing something in the textbox.
    > >
    > > Img_Employee is the name of an image control on the userform, you have added
    > > one?
    > >
    > > "C:\Excel VBA 2003\" & EmpFound & ".jpg" is the name of the actual JPG file,
    > > and it picks up the value from your employee list and appends that to the
    > > path. If the files are GIF files, change the .jpg to .gif, but that cannot
    > > be the error as the code works nicely for me even if the jpg doesn't exist
    > > (doesn't display it of course).
    > >
    > > --
    > > HTH
    > >
    > > Bob Phillips
    > >
    > > (remove nothere from email address if mailing direct)
    > >
    > > "Jennifer" <[email protected]> wrote in message
    > > news:[email protected]...
    > > > Hi Bob,
    > > > Thank you!
    > > > It is giving me the yellow highlight in this area
    > > >
    > > > Img_Employee.Picture = LoadPicture( _
    > > > "C:\Excel VBA 2003\" & EmpFound & ".jpg")
    > > >
    > > > To make sure I am understanding what is written & correct:
    > > > Img_Employee <> This is the Image name on the form
    > > > C:\Excel VBA 2003 <>This is the route to the file
    > > > .jpg <> Picture will need to be in jpg format
    > > > --
    > > > Though daily learning, I LOVE EXCEL!
    > > > Jennifer
    > > >
    > > >
    > > > "Bob Phillips" wrote:
    > > >
    > > > > Jennifer,
    > > > >
    > > > > One of the problems is using the Change event, as this fires on every

    > > letter
    > > > > typed into the textbox. For instance, if you have Bianca, Bill and Bob

    > > in
    > > > > the list, as soon as you type B it loads the first it finds. However, on
    > > > > typing the second letter, it will do a more accurate match, Bi would

    > > then
    > > > > find Bill, and reload with the new image.
    > > > >
    > > > > Although that might be a bit annoying, you should al end up okay, except

    > > of
    > > > > course if you try to enter Brian, where it will error on the Br, but an
    > > > > image is already loaded.
    > > > >
    > > > > What are you experiencing?
    > > > >
    > > > > --
    > > > >
    > > > > HTH
    > > > >
    > > > > Bob Phillips
    > > > >
    > > > > (remove nothere from the email address if mailing direct)
    > > > >
    > > > > "Jennifer" <[email protected]> wrote in message
    > > > > news:[email protected]...
    > > > > > HELP! First time trying this, I am try an example out of a book. I'm
    > > > > stuck.
    > > > > > Do I need to have anything in the Userform Initilize?
    > > > > >
    > > > > > Trying to type Employee name and their picture show up in the

    > > userform.
    > > > > > Thank you. Jennifer
    > > > > >
    > > > > > Private Sub tb_EmpName_Change()
    > > > > > Dim EmpFound As Range
    > > > > > With Range("EmpList")
    > > > > > Set EmpFound = .Find(tb_EmpName.Value)
    > > > > > If EmpFound Is Nothing Then
    > > > > > MsgBox ("Employee Not Found!")
    > > > > > tb_EmpName.Value = ""
    > > > > > Me.tb_EmpName.SetFocus
    > > > > > Exit Sub
    > > > > > Else
    > > > > > With Range(EmpFound.Address)
    > > > > > tb_EmpPosition = .Offset(0, 1)
    > > > > > tb_EmpHireDate = .Offset(0, 2)
    > > > > > On Error Resume Next
    > > > > > Img_Employee.Picture = LoadPicture( _
    > > > > > "C:\Excel VBA 2003\" & EmpFound & ".jpg")
    > > > > > On Error GoTo 0
    > > > > > End With
    > > > > > End If
    > > > > > End With
    > > > > > End Sub
    > > > > > --
    > > > > > Though daily learning, I LOVE EXCEL!
    > > > > > Jennifer
    > > > >
    > > > >
    > > > >

    > >
    > >
    > >



  10. #10
    Jennifer
    Guest

    Re: Userform Image

    I wish i new, I'm just trying an exapmle out of a book in order to try and
    learn. NOT GOING SO WELL!
    --
    Though daily learning, I LOVE EXCEL!
    Jennifer


    "Art H" wrote:

    > Just an uninformed guess: Is it legal to form a string using an object
    > ("Dim EmpFound As Range" and <"C:\Excel VBA 2003\" & EmpFound &
    > ".jpg">)?
    >
    > Art
    >
    > Jennifer wrote:
    > > Yeah Bob,
    > > I get the error when I type the first letter of the employees name. Have any
    > > ideas? Thank you for your time.
    > > --
    > > Though daily learning, I LOVE EXCEL!
    > > Jennifer
    > >
    > >
    > > "Bob Phillips" wrote:
    > >
    > > > Hi Jennifer,
    > > >
    > > > That is odd because it is surrounded by am On Error. Do you get that when
    > > > you try to run it, or after typing something in the textbox.
    > > >
    > > > Img_Employee is the name of an image control on the userform, you have added
    > > > one?
    > > >
    > > > "C:\Excel VBA 2003\" & EmpFound & ".jpg" is the name of the actual JPG file,
    > > > and it picks up the value from your employee list and appends that to the
    > > > path. If the files are GIF files, change the .jpg to .gif, but that cannot
    > > > be the error as the code works nicely for me even if the jpg doesn't exist
    > > > (doesn't display it of course).
    > > >
    > > > --
    > > > HTH
    > > >
    > > > Bob Phillips
    > > >
    > > > (remove nothere from email address if mailing direct)
    > > >
    > > > "Jennifer" <[email protected]> wrote in message
    > > > news:[email protected]...
    > > > > Hi Bob,
    > > > > Thank you!
    > > > > It is giving me the yellow highlight in this area
    > > > >
    > > > > Img_Employee.Picture = LoadPicture( _
    > > > > "C:\Excel VBA 2003\" & EmpFound & ".jpg")
    > > > >
    > > > > To make sure I am understanding what is written & correct:
    > > > > Img_Employee <> This is the Image name on the form
    > > > > C:\Excel VBA 2003 <>This is the route to the file
    > > > > .jpg <> Picture will need to be in jpg format
    > > > > --
    > > > > Though daily learning, I LOVE EXCEL!
    > > > > Jennifer
    > > > >
    > > > >
    > > > > "Bob Phillips" wrote:
    > > > >
    > > > > > Jennifer,
    > > > > >
    > > > > > One of the problems is using the Change event, as this fires on every
    > > > letter
    > > > > > typed into the textbox. For instance, if you have Bianca, Bill and Bob
    > > > in
    > > > > > the list, as soon as you type B it loads the first it finds. However, on
    > > > > > typing the second letter, it will do a more accurate match, Bi would
    > > > then
    > > > > > find Bill, and reload with the new image.
    > > > > >
    > > > > > Although that might be a bit annoying, you should al end up okay, except
    > > > of
    > > > > > course if you try to enter Brian, where it will error on the Br, but an
    > > > > > image is already loaded.
    > > > > >
    > > > > > What are you experiencing?
    > > > > >
    > > > > > --
    > > > > >
    > > > > > HTH
    > > > > >
    > > > > > Bob Phillips
    > > > > >
    > > > > > (remove nothere from the email address if mailing direct)
    > > > > >
    > > > > > "Jennifer" <[email protected]> wrote in message
    > > > > > news:[email protected]...
    > > > > > > HELP! First time trying this, I am try an example out of a book. I'm
    > > > > > stuck.
    > > > > > > Do I need to have anything in the Userform Initilize?
    > > > > > >
    > > > > > > Trying to type Employee name and their picture show up in the
    > > > userform.
    > > > > > > Thank you. Jennifer
    > > > > > >
    > > > > > > Private Sub tb_EmpName_Change()
    > > > > > > Dim EmpFound As Range
    > > > > > > With Range("EmpList")
    > > > > > > Set EmpFound = .Find(tb_EmpName.Value)
    > > > > > > If EmpFound Is Nothing Then
    > > > > > > MsgBox ("Employee Not Found!")
    > > > > > > tb_EmpName.Value = ""
    > > > > > > Me.tb_EmpName.SetFocus
    > > > > > > Exit Sub
    > > > > > > Else
    > > > > > > With Range(EmpFound.Address)
    > > > > > > tb_EmpPosition = .Offset(0, 1)
    > > > > > > tb_EmpHireDate = .Offset(0, 2)
    > > > > > > On Error Resume Next
    > > > > > > Img_Employee.Picture = LoadPicture( _
    > > > > > > "C:\Excel VBA 2003\" & EmpFound & ".jpg")
    > > > > > > On Error GoTo 0
    > > > > > > End With
    > > > > > > End If
    > > > > > > End With
    > > > > > > End Sub
    > > > > > > --
    > > > > > > Though daily learning, I LOVE EXCEL!
    > > > > > > Jennifer
    > > > > >
    > > > > >
    > > > > >
    > > >
    > > >
    > > >

    >
    >


  11. #11
    Bob Phillips
    Guest

    Re: Userform Image

    bob dot phillips at tiscali dot co dot uk

    do the obvious

    --

    HTH

    Bob Phillips

    (remove nothere from the email address if mailing direct)

    "Jennifer" <[email protected]> wrote in message
    news:[email protected]...
    > Bob,
    > I tried to email you using the email address you have in your profile and
    > received a message back saying it can't be delivered. What address you

    like
    > me to use? Thank you, Bob. Jennifer
    > --
    > Though daily learning, I LOVE EXCEL!
    > Jennifer
    >
    >
    > "Bob Phillips" wrote:
    >
    > > Jennifer,
    > >
    > > I cannot re-create the problem. Can you mail me the workbook?
    > >
    > > --
    > >
    > > HTH
    > >
    > > Bob Phillips
    > >
    > > (remove nothere from the email address if mailing direct)
    > >
    > > "Jennifer" <[email protected]> wrote in message
    > > news:[email protected]...
    > > > Hey Bob,
    > > > I did go ahead and change Private Sub tb_EmpName_Change() to Private

    Sub
    > > > tb_EmpName_Click()
    > > >
    > > > Now when I hit tab or enter it doesn't fill the image box it just goes

    to
    > > > the next text box. When I switch it back to <tb_EmpName_Change> I get

    the
    > > > problems I was having before
    > > > --
    > > > Though daily learning, I LOVE EXCEL!
    > > > Jennifer
    > > >
    > > >
    > > > "Jennifer" wrote:
    > > >
    > > > > HELP! First time trying this, I am try an example out of a book. I'm

    > > stuck.
    > > > > Do I need to have anything in the Userform Initilize?
    > > > >
    > > > > Trying to type Employee name and their picture show up in the

    userform.
    > > > > Thank you. Jennifer
    > > > >
    > > > > Private Sub tb_EmpName_Change()
    > > > > Dim EmpFound As Range
    > > > > With Range("EmpList")
    > > > > Set EmpFound = .Find(tb_EmpName.Value)
    > > > > If EmpFound Is Nothing Then
    > > > > MsgBox ("Employee Not Found!")
    > > > > tb_EmpName.Value = ""
    > > > > Me.tb_EmpName.SetFocus
    > > > > Exit Sub
    > > > > Else
    > > > > With Range(EmpFound.Address)
    > > > > tb_EmpPosition = .Offset(0, 1)
    > > > > tb_EmpHireDate = .Offset(0, 2)
    > > > > On Error Resume Next
    > > > > Img_Employee.Picture = LoadPicture( _
    > > > > "C:\Excel VBA 2003\" & EmpFound & ".jpg")
    > > > > On Error GoTo 0
    > > > > End With
    > > > > End If
    > > > > End With
    > > > > End Sub
    > > > > --
    > > > > Though daily learning, I LOVE EXCEL!
    > > > > Jennifer

    > >
    > >
    > >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1