Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Put images from worksheet onto userform 1

Status
Not open for further replies.

DrBowes

Programmer
Jul 16, 2003
150
GB

Hi, ideas for this one are appreciated.

I have a worksheet with several images on it (gifs pasted onto the worksheet). When a userform is opened I would like a random one of these images to be used as the image on an image control on a userform.

Can easily select a random image from the worksheet, but how can this be placed into the image control?




 
I don't think you can. The image that shows in the image control is explicitly stated, as a property. It is a file, not a selection object. I do not think you can paste into a image control from a selection.

object.Picture = LoadPicture( pathname )

Pathname is required.

Gerry
 
Have a look here for the underlying code to do this


It shows he basics of saving an Image

Ivan F Moala
xcelsmall.bmp
 

Ivan

I have been on your site a few times before - it is awesome.
 
Yes, great site!

Ivan, you still can't get the image onto a UserForm except by saving the image as a file, and then loading it, right? It still must be explicitly loaded as a file. Pathname is still required, yes?

There is not a way to paste directly, as the original post asked.

Or am I missing something?

Gerry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top