pull up pictures This is a topic that many people are looking for. bluevelvetrestaurant.com is a channel providing useful information about learning, life, digital marketing and online courses …. it will help you have an overview and solid multi-faceted knowledge . Today, bluevelvetrestaurant.com would like to introduce to you Pull Up Photos Dynamically on a Userform – Great For Employee or Product Maintenance Form. Following along are instructions in the video below:
“There youtube is dan strong with excel. Vba is phone. Today. We re going to to learn about using photos dynamically on a user form what that means is whenever are clicking around and you make a selection on your combo box or a list box or something.
The photo assigned to that line or that row is going to pop up on here on the user form so right now i have a template user form just basically i have assigned this list here to this combo box this drop down here and they have a pin number. And there s a description. And there is actually an image in the database. As well then i have all three columns represented here on this drop down menu.
What i ve done is i ve actually just named this range. I ve named it my table to keep things simple. And what i ve done here on the user form is when i click on the combo box. I went down to row source and i typed in my table.
The name of the range that i ve named and so that s what pops in here. The first column third or second and third. And then whichever selection is made that value is the whatever s in the first column. But you can still access the second and third and so on and i m going to show you how to do that and more importantly.
I m going to show you how to load the picture into here so let s get started. What you need to do for this experiment. Is you need to have the name of some files. So really quickly i ll show you how i came upon these file locations.
If you don t know for example. I ll raise the ones for cats here and i will grab that photo right here from my folder here s a picture of the cat..
So i ll right click and go to properties or you can hit the letter. R. And if you go to the security tab. You see that the the location is right there you can also find it if you know your way around computers.
I m going to hit control c. After highlighting that and then i ll go back to my worksheet and click in there and control v to paste. And there s the location of my cats. So let s get to the userform hit alt f11.
Now. What we re going to do is every time. That this combo box is changed. We re going to have it look.
And see. If there s a file location. If so loaded in there so double click on there. And we have a change event of the combo box that i named cmb img that s a combo box.
Which is double clicked on so whatever changes here. What i want to do first of all if there s errors to just keep on tracking. So i type on error zoom. Next that way it won t give errors okay.
So here s the first thing you need to do let s make a variable called my image you can name that anything one that s just going to take on the name of whatever is in what i call what i consider that 1 2. 3..
The third column. But in excel and the list. That is the combo box. It s actually the 0 1.
2. The second column so we ll we ll show you how to do that so. Let s reference. The combo box image.
So me dot c and b. Image dot. Dot list and use your parentheses. So now we need the the row and the column for the particular thing that we want and so.
The row is going to be the me dot cmb image dot ah. Let s see that list index excuse me. I was thinking row index for some reason so you need the me done the the list index and that s the current row. That s been selected and then the column that you want again we start with zero.
And not one it s zero. One two in that particular combo box. So we want column two. So.
What that will do let s put a stop marker and i ll show you whenever i click on let s say cat it ll say the list index is 1 because the donkey would be zero. So number number 1 and then the column..
2. Which would be 0 1. 2. Will give us the cats location.
So hit f8 and you ll see that my image now has taken on blah blah blah cats jpg or whatever zone that s the image location then here s the beautiful part the we re going to load the picture on there so me dot image. 1. That s the name of the image block way over there that equals and here s here s the code that you need is called load picture and use your parentheses. That s a built in function that will help you to load the actual picture into there oops me down image 1 dot.
Picture. Equals load picture. And then use the file location. So you could put quotes and put c.
Blah blah. Daniel. My documents desktop whatever but we are just going to use my image. Because that is kind of what we ve gleamed from column.
2. There so that we ll get that there and then i think we also put a label there yeah. I put a label just called label 1 for now. But i want that to say the word donkey or the word cat or the word sheep.
Whatever the description which would be 0 1. So it d be the column 1..
So double click. There and really quickly. We ll just do something very similar to this so me dot label. One equals that only column one remember zero one two so i hit f5 with me.
And let s choose the one for cat. So my image is that now image 1 dot picture equals that and then the label equals. One says cat so let s take away the stop marker. And let s just play with it so there s cat let s go to the donkey one what do you know it loaded the picture of the donkey and the sheep.
It loaded the sheep and those are all located on my desktop in a folder called my pics you can take this from any location on your computer. If you re on a network. You can use a shared drive that way it ll be more consistent as long as you leave the pictures there. And don t move them otherwise you may find this being blank anyway this could be great for a photo directory.
It could be good for if you have an employee master list or some kind of product database that you re managing on a user forum as soon as you click on them whether it s a list box or a combo box. Or whatever you make a selection. Why a picture might just happen to pop up if it s a vlookup or some kind of some way to get it from your database. It s the information to your sheet.
There it s very simple to do ” ..
Thank you for watching all the articles on the topic Pull Up Photos Dynamically on a Userform – Great For Employee or Product Maintenance Form. All shares of bluevelvetrestaurant.com are very good. We hope you are satisfied with the article. For any questions, please leave a comment below. Hopefully you guys support our website even more.