Image not loading based on Textbox value

ajaypal_sp

New Member
Joined
Feb 11, 2015
Messages
25
Hi,


I create basic Userform. In that, I want to load image based on Combobox / TextBox value. But image is not loading. Please go through the below code and Help me.

Code:
Private Sub cmbimg_Change() Me.TextBox1.Value = Application.WorksheetFunction.VLookup(Me.cmbimg.Value, xRg, 2, False)
End Sub


Private Sub UserForm_Activate()
ipath = "C:\Users\Ajay\Desktop\Fruit Images\"
On Error Resume Next
With Me.cmbimg.Value
Me.imgData.Picture = LoadPicture(Me.TextBox1.Text)
'Me.imgData.Picture = LoadPicture(ipath & Me.cmbimg.Value & ".JPG")
End With
End Sub


Private Sub UserForm_Initialize()
Dim xRg As Range
    Set xRg = Worksheets("Sheet3").Range("A2:B33")
    Me.cmbimg.List = xRg.Columns(1).Value
End Sub


thank you for your help.


regards
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
What happens if you remove this?
Code:
On Error Resume Next
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,287
Members
452,631
Latest member
a_potato

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top