Hello Tom,
I had given DoEvents a try, but it had no affect.
As a test, I threw together the following code, and this didn't
respond either. At least not until the macro aaa() was finished
running.
In my Chartool code, I initialize a class with events on a chart, and
I've successfully got it responding to a host of key presses. So if I
get amibitious enough, I should be able to use that approach for my
animation.
Brian
Sub aaa()
Application.OnKey "{right}", "sub2"
[a1].Select
Do
DoEvents
Selection.Offset(1, 0).Select
DoEvents
For j = 1 To 10000
DoEvents
Next j
DoEvents
i = i + 1
DoEvents
Loop Until i = 10
End Sub
Sub sub2()
MsgBox "right"
DoEvents
End Sub
"Brian Murphy" wrote in message ...
Thanks for the reply, Tom. It looks like classing the chart so I can use
events would be the easiest way to do this. I've done some of this before
with my chartool.xla utility, so I should be able to do it again.
Cheers,
Brian
"Tom Ogilvy" wrote in message
...
I think you would need to subclass Excel and or hook into the keyboard
buffer. See this thread by Stratos
http://groups.google.com/groups?thre...9237C%40iti.gr
for some ideas.
--
Regards,
Tom Ogilvy
"Brian Murphy" wrote in message
...
Hello to all you Excel Wizards,
I have a macro that does some quick and dirty animation with an embedded
chart (I just use a simple loop, and the Escape key to halt). I'm pretty
happy with how the animation works but I'd like to enable some keypress
commands to control the animation, and excel does not respond to
keystrokes
while my animation macro is running. This behavior actually makes some
sense since you can't click on cells or do anything else while the
animation
macro is running. I use Application.EnableCancelKey to respond to a press
of the Escape key. But Application.OnKey does not work for other keys.
Is there any way to allow my animation macro to respond to presses of
other
keys besides Escape?
I might point out that I have successfully worked out using mouse
movements
to control the animation stream. If the mouse isn't moving, the animation
plays normally. If the mouse is moved to the right(or left) the animation
plays forward (or backward) as long as the mouse keeps moving. Otherwise
it
starts to play normally again. I'm using the API call GetCursorPos to do
this. This is pretty cool. At least to me.
Anyway, responding to some other keystrokes would be nice. I hope it can
be
done without diving into classes and events, which I suppose is possible
since the animation is being done with a single excel chart.
Thanks,
Brian Murphy
Austin, Texas