Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

VBA Macro to insert image in a userform (Calling the images from the worksheet itself)

Status
Not open for further replies.

FabienF

New member
Jul 5, 2017
19
0
0
FR
Hello,
I am trying to display an image on a userform depending on the choice of a combo box and the code below works fine:

picturename = "S:blablablabalabalab\blabla\" & name & ".jpg"
Userform.Image.Picture = LoadPicture(picturename)

However, I would like to avoid referring to the location S:blablablabalabalab\blablaInstead I would like to retrieve the image from an Excel worksheet itself (that I would hide afterwards).
In fact, the macro I am implementing will be used by several users on different computers, thus creating potential errors if they don't have access to that specific location (S:blablablabalabalab\blabla\)

Is there any way to that? call the images from the images from the worksheet itself?

Thanking you for your help in advance.
 
Replies continue below

Recommended for you

Thank you tesak for your quick response.
Indeed it is too complicated to use WIN API for my case.
As I had only 15 images to choose with the combobox, I decided to do differently:
I created 15 images control in the userform which are therefore overlapped and I copy/pasted ( picture property) my pictures in each one of them.
This method works fine and the images are saved in the Workbook itself.

 
Status
Not open for further replies.
Back
Top