Chart Events - Trapping arrow key strokes

G

Guest

Hi,
I was referred to an article by Jon Peltier for how to trap chart events
and it was very helpful with trapping mouse clicks on all areas of a chart.
I've got some code that inserts small jpg images on the chart whenever a
single chart point is selected. That portion works well. I'd like a user to
use the arrow keys to move from point to point rather than mouse clicking on
each point. One reason for this is that some groups of datapoints are
tightly packed and difficult to click on separately. The Chart Events
routines provided by the article don't recognize subsequent point selections
when initiated using the arrow keys. I looked at the specific events
trappable and none deal with keyup or keydown while a series point is
selected. Please let me know if you know a work-around.

Regards.
 
A

Andy Pope

Hi,

As you have discovered the chart does not expose any key based events.
I can't think of any work arounds in terms of events. But maybe you
could use a userform to allow the use to select chart elements.

Cheers
Andy
 
T

Tushar Mehta

Neither of these suggestions is trivial or fully tested.

1) Use the OnKey method to trap the use of the arrow key(s). Of course, you
will then have to select the appropriate item yourself.

2) Use OnTime to trigger a routine every second. This routine would use the
XL4 macro -- SELECTION() -- to detect what chart element, if any, was
selected. [You could speed up the rate at which the routine is executed by
using the Windows SetTimer and KillTimer APIs but there are other issues you
will have to address with these routines.]

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions
 
G

Guest

Hi Tushar,
I went with the OnKey method. It works perfectly. I just had to make
sure I enable/disabled it at the right times and error trapped appropriately.
Thanks for the suggestion.

RLang

Tushar Mehta said:
Neither of these suggestions is trivial or fully tested.

1) Use the OnKey method to trap the use of the arrow key(s). Of course, you
will then have to select the appropriate item yourself.

2) Use OnTime to trigger a routine every second. This routine would use the
XL4 macro -- SELECTION() -- to detect what chart element, if any, was
selected. [You could speed up the rate at which the routine is executed by
using the Windows SetTimer and KillTimer APIs but there are other issues you
will have to address with these routines.]

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

Hi,
I was referred to an article by Jon Peltier for how to trap chart events
and it was very helpful with trapping mouse clicks on all areas of a chart.
I've got some code that inserts small jpg images on the chart whenever a
single chart point is selected. That portion works well. I'd like a user to
use the arrow keys to move from point to point rather than mouse clicking on
each point. One reason for this is that some groups of datapoints are
tightly packed and difficult to click on separately. The Chart Events
routines provided by the article don't recognize subsequent point selections
when initiated using the arrow keys. I looked at the specific events
trappable and none deal with keyup or keydown while a series point is
selected. Please let me know if you know a work-around.

Regards.
 

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