View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Prevent control taking focus when accelerator key is used?

I tested it before I posted and it worked for me. Maybe you haven't
accurately articulated your problem. I put a 1 in the property for
accelerator for the commandbutton. My suggestion fixed the problem you
cited when I did Alt+1.


--
Regards,
Tom Ogilvy


"Michael Jones" wrote in message
...
1 - Apologies if anyone received 2 identical emails from me - my email
reader did not display the 1st email I sent.

2 - Tom - thanks for your response, but as I see it I need something like
your solution when I press the (eg) Alt + 1 keys.
Is there some sort of global way to trap the Alt + 1 key combination or
will I have to do a bit of coding for each control that loses focus
because of Alt + 1 ?

Thanks,
Michael Jones

"Tom Ogilvy" wrote in message
...
that appears to be by design. I would suggest that as the first command
in the click event you do

ActiveCell.Activate


--
Regards,
Tom Ogilvy

"Michael Jones" wrote in message
...
I can prevent a Command Button taking the focus when it is clicked, by
setting this property to false at design time.
But, this doesn't seem to work when an accelerator key is used - how do
I prevent the Command Button taking the focus when it is activated with
an accelerator key (eg Alt + 1) ?

Using Excel 2003 with Windows XP Professional.

Thanks,

Michael Jones