comment picture to userform

casinsh

New Member
Joined
Dec 30, 2011
Messages
3
Hi there! i would like to know if its possible to get image from comment and add it to userform?

at this moment i have added image to comment and user form, but now i have to get that image to other form. is it possible at all?
Private Sub CommandButton1_Click()

Dim Pict
Dim ImgFileFormat As String
Dim cmt As Comment
Range("a1").Comment.Delete
Set cmt = Range("a1").AddComment

cmt.Text Text:=""

ImgFileFormat = "Image Files (*.jpg),others, png (*.png),*.png"

Pict = Application.GetOpenFilename(ImgFileFormat)
If Pict = False Then End

UserForm1.Image1.Picture = LoadPicture(Pict)
Image1.PictureSizeMode = fmPictureSizeModeStretch


With cmt.Shape
.Fill.UserPicture Pict
End With

End Sub

or is there any other way to get picture to sheets cell and later at any time that same picture to other userform picturebox

if misunderstood, ask whats needed

thanks
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Whilst I don't think you can get at the picture once it is loaded into the comment you can create an image copy of the comment using the CopyPicture method of the comments shape object.

You can the use Stephen Bullen's PastePicture code to load a image control on a userform with the copied image.
http://www.oaltd.co.uk/Excel/Default.htm

This code example will copy a comment. You just need to incorporate Stephen's code to populate the image control.

Code:
Private Sub CommandButton1_Click()

    Dim objComment As Comment
    Dim shpTemp As Shape
    
    Set objComment = Range("C5").Comment
    Set shpTemp = objComment.Shape
    
    Application.ScreenUpdating = False
    objComment.Visible = True
    shpTemp.CopyPicture xlScreen, xlPicture
    objComment.Visible = False
    Application.ScreenUpdating = True
    
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,099
Messages
6,170,107
Members
452,302
Latest member
TaMere

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top