How to load images in userform image box

arool.m

New Member
Joined
Apr 12, 2007
Messages
40
i have a userform which contains the following feilds

1) combobox1 ( added item : Apple,Mango,Banana)
2) Image1 (rectangular Images Box)

Mypath = D:\Images\
i) "Apple.jpg",
ii) "Mango.jpg",
iii) "Banana.Jpg"

whenever i use to change combobox.value , image box will pick automatically images from the above mentioned path
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
This should give you the general idea. For further information have a look at the picture property and loadpicture function topics in your VBA helpfile.

Code:
Private Sub ComboBox1_Change()
    Const sPATH As String = "D:\Images\"
 
    With ComboBox1
        If .ListIndex > -1 Then
            Image1.Picture = LoadPicture(sPATH & .Value & ".jpg")
        End If
    End With
End Sub

HTH
Colin
 
Upvote 0
You might get brisker response if you pre-loaded three images and the combobox controled their visibility.
 
Upvote 0
Hi All. Looking for your help please.

Which would be the best method of doing this but with 300 images?

I have a text box contained in a userform where users type in the relevant image number ... then depending on the number entered I want the relevant image to appear. Is this possible with so many images ?

Ideally, i would like this contained within the Excel spreadsheet so it is transportable between users .. that is not retrieving images from the c: drive or other.

Apologies for the simplistic language but i'm new to this.

Grateful for your help. Thanks
 
Upvote 0

Forum statistics

Threads
1,215,339
Messages
6,124,381
Members
449,155
Latest member
ravioli44

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