insert picture into comment from active worksheet (not from path)

witamserdecznie

New Member
Joined
Jun 12, 2010
Messages
34
Hi,

It is quite easy to find on the web how to insert a picture from a harddrive into comment in Excel.

goes like:
Code:
If Target.Address = "$K$16" Then
NewPic = "C:\Users\witamserdecznie\Desktop\" & Range("$K$16").Value
Target.Comment.Shape.Fill.UserPicture NewPic
End If
However how to show picture in a comment that is taken from activeworksheet? I.e. The pictures are already hidden in the worksheet and I just want them to show if appropriate value is selected in certain cells. How to do that?

Thanks,
witamserdecznie
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
That this is exactly what I did not want to do. Problem then is that I have to send all images with the .xls file.

Is not there an option to show images in a similar way as the following code works:

Code:
If Target.Value = "12" Then
ActiveSheet.Shapes("picture 12").Visible = True
Else
ActiveSheet.Shapes("picture 12").Visible = False

The above works quite well (the picture 12 has to be previously imported into excel sheet) but it does not paste image into a comment - which is what I want.

Thanks,
witamserdecznie.
 
Upvote 0
You said "how to show picture in a comment that is taken from activeworksheet?". So why are you complaining that you "have to send all images with the .xls file"?
 
Upvote 0
not sure I see your point.

How to take it from active worksheet was and is my main question. By that I mean to take it from a worksheet and not from a harddrive by giving a path, say C:\pics\... in vba.

As a result I sent only one file and do not have to include a folder with pictures as these are imported into worksheet. Hope that is clear now.

Is there a way to do it? or more importantly do you know how to do it?

Thanks,
witamserdecznie
 
Upvote 0
The code in the link I gave you exports a picture on a worksheet to disk and uses that (temporary) file, which can be deleted at the end of the procedure with the Kill statement. You do not need to send out any files with your workbook, but it must contain the pictures you want to use.

Here is another example which adds a picture to an Image control, which also requires that the picture is on disk.

http://www.mrexcel.com/forum/showthread.php?t=83429
 
Upvote 0

Forum statistics

Threads
1,214,561
Messages
6,120,225
Members
448,951
Latest member
jennlynn

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