VBA Excel: Insert an Image into a UserForm
phileas1412
Posted messages
7
Status
Member
-
Eric_paris -
Eric_paris -
Hello,
I'm looking to insert an image that is in an Excel file into a userform at the "image" frame level. This operation should be triggered from a combobox, so that the images change as you click on a name in the combobox.
Do you have a solution???
Thank you in advance
Phileas1412
I'm looking to insert an image that is in an Excel file into a userform at the "image" frame level. This operation should be triggered from a combobox, so that the images change as you click on a name in the combobox.
Do you have a solution???
Thank you in advance
Phileas1412
Configuration: windows xp pro excel 2000
2 answers
Create your photos in JPG format (via Microsoft Photo Editor)
Place your photos in a directory that you have previously created (c:\rep\ss_rep\photos\).
Use the following macro (Combobox1_click):
photo_path = "C:\rep\SS_rep\Photos\"
photo_name = Userform1.combobox1.value
full_name = photo_path & photo_name & ".jpg"
UserForm1.Frame1.Picture = LoadPicture(full_name)
The values you display in your Combobox1 must correspond to the names of the JPG files you have created, without the .JPG extension.
Place your photos in a directory that you have previously created (c:\rep\ss_rep\photos\).
Use the following macro (Combobox1_click):
photo_path = "C:\rep\SS_rep\Photos\"
photo_name = Userform1.combobox1.value
full_name = photo_path & photo_name & ".jpg"
UserForm1.Frame1.Picture = LoadPicture(full_name)
The values you display in your Combobox1 must correspond to the names of the JPG files you have created, without the .JPG extension.