Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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" wrote in message ... 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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" wrote in message ... 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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" wrote in message ... 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" wrote in message ... 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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" wrote in message ... 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" wrote in message ... 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 befo( -- 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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" wrote in message ... 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 befo( -- 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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" wrote in message ... 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 befo( -- 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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" wrote in message ... 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" wrote in message ... 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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" wrote in message ... 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" wrote in message ... 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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" wrote in message ... 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" wrote in message ... 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 befo( -- 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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Change image in UserForm | Excel Programming | |||
moving an image in a userform | Excel Programming | |||
UserForm as a Jpeg Image | Excel Programming | |||
Bmp vs Gif in Userform image controls | Excel Programming | |||
Userform Image help | Excel Programming |