View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.charting
Andy Pope Andy Pope is offline
external usenet poster
 
Posts: 2,489
Default How do I (or can I) add a chart within a comment?

You would need to run code every time the chart data changed.
When you say the chart is real-time do you mean the numbers are constantly
changing or that they are updated 1 a day/week/month?
Which ever you will need to run some code.
So here is some code to place the image in a comment. Just change the
chartobject and cell reference.

'--------------------------
Sub Test()

m_MakeCommentChart ActiveSheet.ChartObjects(1), Range("D3")

End Sub

Sub m_MakeCommentChart(Cht As ChartObject, Rng As Range)

Dim strTempFile As String
Dim objComment As Comment

On Error GoTo ErrMakeCommentChart

strTempFile = ThisWorkbook.Path & Application.PathSeparator & "xyz" &
Format(Now(), "yyyymmddhhmmss") & ".gif"

Cht.Chart.Export strTempFile
Set objComment = Rng.Comment
If objComment Is Nothing Then
Set objComment = Rng.AddComment
End If
objComment.Shape.Fill.UserPicture strTempFile

Kill strTempFile

ErrMakeCommentChart:
Exit Sub

End Sub
'--------------------------

You could try your suggestion here, but don't hold your breath.
http://office.microsoft.com/en-gb/su...0551033&type=0

Cheers
Andy

--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
"GeneW" wrote in message
...
Your directions for embedding a chart to a comment was great.

Do you have any thoughts on how I can have a real-time chart open and
close
so it would be attached to a cell?
I am flexible on was to do this, but I have an excel spreadsheet and I
want
peoples sales numbers to be on the sheet but not always open large
pictures.
I would like them to work very similar to the way comments pop up.

Also, would you know how I could go about making this suggestion to
Microsoft if there is not a way for this to work?

Thanks in advance for your help.


"Andy Pope" wrote:

Hi,

You can export the chart as an image and then set the comments picture to
that image.
http://www.contextures.com/xlcomments02.html#Picture

Obviously the chart will not update in real time.

Cheers
Andy
--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
"GeneW" wrote in message
...
I want my chart (very small chart) to emerge when you hover over a sales
number.
As if the chart was embeded within a comment.
When you go over a cell with a comment, it opens up.
I do not want the chart or graph to be present on other pages or tabs.