PDA

View Full Version : Solved: Insert Image from Userform Commandbutton.



gabethegrape
05-06-2009, 03:06 PM
In my userform, I have an image on my commandbutton. When the user clicks the commandbutton I want that image to be inserted into the worksheet. I want to create this as part of an Addin. Is this possible to do if the user does not have the image source file on their computer?

Here is the code I have so far (which does not work):

Private Sub cmdInsert_Click()
Range("D1").Value = cmdInsert.Picture
End Sub

Bob Phillips
05-06-2009, 03:19 PM
Store the image in the workbook that the form lives in and copy it from there.

gabethegrape
05-06-2009, 03:55 PM
Store the image in the workbook that the form lives in and copy it from there.

How do I reference an object in the Addin workbook? I tried this and I could only access the open workbook objects (not the addin).

Bob Phillips
05-06-2009, 04:14 PM
Shouldn't be a problem



ThisWorkbook.Worksheets("images").Shapes("myPic").Copy
ActiveWorkbook.Worksheets("Sheet1").Paste

Bob Phillips
05-06-2009, 04:14 PM
Shouldn't be a problem



ThisWorkbook.Worksheets("images").Shapes("myPic").Copy
ActiveWorkbook.Worksheets("Sheet1").Paste

gabethegrape
05-06-2009, 10:54 PM
Thanks xld,
This just opened up a lot of doors for me!
Gabe

Bob Phillips
05-07-2009, 01:25 AM
That's great. A simple answer that creates possibilities, sharing at its best, what more could we ask for :)