Beyond "Changing Hover Labels"

M

MikeM

I have a similar question (answered in a 9/17 post) with regard to accessing
tool tips. I'm plotting time series data that occasionally has anomalous
entries, and I want to give the user a chance to look at the chronological
context. I'd like to capture the date of the anomalous entry by
right-clicking on the point and capturing the date of that entry, which is
included in the tool tip when the cursor sits on the point. This brings up 2
questions:

1. How do I capture the date?

2. How do I add a menu item to the contextual menu?

TIA,
Mike
 
L

Leith Ross

Hello Mike,

I can partially answer your second question. I am going to assume you
are talking about chart data. It would be helpful to know more about
the chart and where on the chart you want to extract information. I
bring this up because a chart has several context menus.

I am providing you with an example of how to add an item to the
context menu for a Cell on a Worksheet. This example will allow you to
call your own macro.


Code:
--------------------
Sub AddToContextMenu()

Dim cmdNew As CommandBarButton

Set cmdNew = CommandBars("cell").Controls.Add

With cmdNew
.Caption = "My Procedure" 'This is what shows on the menu
.OnAction = "MyProcedure" 'Name of the macro to execute
.BeginGroup = True
End With

End Sub
_________________________________________________

Sub RemoveContextMenuItem()

On Error Resume Next
CommandBars("cell").Controls("My Procedure").Delete

End Sub
 
M

MikeM

Thanks, Leith, this is very helpful. But I still need to get the first
question answered, to get the date to put in the menu.

Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top