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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Load Excel image on form

Status
Not open for further replies.

bpeirson

Technical User
Sep 28, 2005
85
CA
I am trying to load a picture onto an image in a form.

The picture I want to load is on sheet1 of an Excel file.

I have searched Tek-Tips and all relevent threads except one show how to load a picture from a separate file
Code:
Image1.Picture = LoadPicture("C:\Foldername1\foldername2\picture.jpg")

I have tried this
Code:
Image1.Picture = LoadPicture(Sheet1.Picture1)
but it doesn't work. "Method or Data member not found." is the error I get.

Excel help files have led nowhere. Any help is appreciated.

 
Thanks. I have already investigated this solution but I am trying to load a picture onto an image on a userform.

Help files show how to to this by referencing a path to the file on the harddrive.

I want to reference a picture on the parent sheet of the userform. I think my syntax is incorrect.

 
I have just realised that the picture name is actually a named range in Excel. I will have to try out using range refences.
 
I have been playing with this a bit. The only way I could get it to work was to create "Images" on the worksheet and manually insert the picture onto each worksheet image using the button in the properties window for each image. I suppose the pictures could be added at run time to the worksheet images using LoadPicture.
At any rate, you can then use the following:

UserForm1.Image1.Picture = ActiveSheet.Image1.Picture
UserForm1.Show
UserForm1.Image1.Picture = ActiveSheet.Image2.Picture
UserForm1.Show

I don't know if this is any help but I did get the image to change in the userform.

Greg
 
Thanks, I lost hope for that method and opted for the hide show property and just piled all the images in the same place.

Maybe more memory is required for multiple copies of the same image but I will compare to your suggestion. Speed and ease of coding will determine which method I choose.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top