I have a userform (ufIcons) where I populated several image controls with icon images (small bitmaps).
I'm looking for a way to access the bitmap and copy it to a cell when the user clicks on the image control.
To be clear, the bitmap is stored directly in the container (i.e. there is no file on the hard drive). I would much prefer to store the images on the userform and avoid storing the images as image files in a folder or as pictures on a worksheet.
The challenge: successfully accessing the bitmap and loading it into a picture/shape/image container to be copied to a worksheet.
End Goal: Copy the image to the activecell when the user initiates a specific UserForm("ufIcons").ImageControl click event
The question: Is there a way to access the bitmap (possibly using VBComponents)?
Here is my code with several different test methods:
Dim Img1 As Image
Dim Pic1 As Object
Dim Pic2 As Object
Dim vbc1 As VBComponent
Set Img1 = ufIcons.face_smile
Set Pic1 = Img1.Picture
Pic1.CopyPicture xlScreen, xlPicture
'Produces Error 438: Object doesn't support this property or method
Set Pic2 = ActiveSheet.Shapes.AddPicture(Pic1, False, True, 1, 1, 1, 1)
'Produces Error 1004: Object doesn't support this property or method
Set vbc1 = ThisWorkbook.VBProject.VBComponents("ufIcons")
'Works, is there a way to drill down?
Bookmarks