Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Prevent control taking focus when accelerator key is used?

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


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

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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Prevent control taking focus when accelerator key is used?

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





  #4   Report Post  
Posted to microsoft.public.excel.programming
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







  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Prevent control taking focus when accelerator key is used?

Tom

Now I understand your solution and it has solved the problem.
I hadn't realized that an accelerator key produces a 'click' event. :)
It then became an easy matter to code to this event.

Many thanks,

Michael Jones

"Tom Ogilvy" wrote in message
...
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









Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Taking control of an existing instance of Excel nmventure Excel Programming 10 November 6th 05 03:13 PM
Show userform without it taking focus? leah Excel Programming 2 August 10th 04 07:07 PM
Set Focus Problem for textbox control on multipage control ExcelDeveloperSPR Excel Programming 1 July 16th 04 08:54 PM
Taking focus off a Control Checkbox Don Wiss Excel Programming 1 November 11th 03 12:18 AM
Simulating the Format Painter, Selection.Select, and taking focus David McRitchie[_2_] Excel Programming 3 July 10th 03 03:48 AM


All times are GMT +1. The time now is 06:53 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"