Can I show a picture depending on what data is selected in a cell

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I would like to show a jpeg picture representing the data that is selected
from a dropdown list. If the value changes, I would like the picture to
change.
 
Create yourself a Userform, named Userform1 and in the code window behind the
Userform paste in:

Private Sub ComboBox1_Change()
Image1.Picture = LoadPicture("C:\CLIPART\PHOTOS\OFFICE\" & ComboBox1.Value &
".jpg") ' <<change to suit !!
End Sub

Private Sub UserForm_Initialize()
Dim i As Long
Dim Vlist As Variant
Vlist = Array("Computer", "Coffee", "Keyboard") 'Change to the Actual
Filename
For i = LBound(Vlist) To UBound(Vlist)
ComboBox1.AddItem Vlist(i)
Next i
End Sub

Also create (Using the Control Toolbox type) a combobox on the Userform,
named combobox1;


That should get you started...

Jim
 
You will also have to add an Image Control to your Userform, and in the
properties window of the Image control change the Property "PictureSizeMode"
to #2 selection.
 
Back
Top