PDA

Click to See Complete Forum and Search --> : RESOLVED[Insert a Picture in a UserForm from a Worsheet]


Fonty
May 7th, 2006, 02:29 PM
I want to insert a picture in a UserForm. However this picte is already located in a worksheet of the workbook. How can I do this?

RobDog888
May 7th, 2006, 02:36 PM
Welcome to the Forums.

Is your picture an Inlineshape or an OLEObject?

You would reference which ever it is and add a Image control to your userform and set the Picture property to the referenced image.

Fonty
May 7th, 2006, 02:49 PM
What is the difference between an Inlineshape or an OLEObject?
I have two differente pictures I would like to insert. One is a jpg picture that is in the worksheet and the other one is a drawring I made with the drawing tools in Excel.

RobDog888
May 7th, 2006, 03:05 PM
Did you do an Insert Image from the Insert menu or created the image/shape from the drawing oolbar? Te only difference is how we will access and reference the image.

Fonty
May 7th, 2006, 03:29 PM
I have both. One inserted in the worksheet using the Insert Image and one created with the drawing toolbar. And I'd like to use both images.

RobDog888
May 7th, 2006, 04:13 PM
The one that is from the insert image is a Shape or OLEObject.

You can reference it but not the image or picture property.


ThisWorkbook.Sheets("Sheet1").Shapes(1)

Fonty
May 7th, 2006, 04:22 PM
Yes. In fact I'm able to manipulate them on the sheet. I have for example:

ActiveSheet.Shapes(tipogas).Visible = True

Where tipogas was a String I defined. However my issue is to be able to see an Image displayed in the UserForm. I want to put 5 different option buttons and the picture to which each option is reffered to upon the button.

koolsid
May 7th, 2006, 06:14 PM
Hi Fonty

i remember reading a same problem earlier so i just searched the web and finally found it ;)

Click the link below and read the solution given by Stephen Bullen.

http://groups.google.co.in/group/microsoft.public.excel.programming/browse_thread/thread/8cfbfbffb986ae8/91305eb70bd975c7%2391305eb70bd975c7

Hope this helps...

DKenny
May 8th, 2006, 08:51 AM
Have a look at my code in the following thread for the PastePicture function. In this case it is used to copy a Chart picture to a UserFrom, but could also be used to copy any picture.
http://www.vbforums.com/showthread.php?t=402588