ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Command Buttons (https://www.excelbanter.com/excel-programming/394490-command-buttons.html)

ADK

Command Buttons
 
After the user clicks the command button and
the code executes, the button is still focused.
In code I only know to place Range("A7").Select to unfocus the button.
Without this line the button remains focused. If you press the Esc key it
unfocuses. I would like the result to be similar to the Esc key with having
to select a cell. Possible? How?



Ron de Bruin

Command Buttons
 
Hi ADK

See the TakeFocusOnClick property of the button


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"ADK" wrote in message ...
After the user clicks the command button and
the code executes, the button is still focused.
In code I only know to place Range("A7").Select to unfocus the button.
Without this line the button remains focused. If you press the Esc key it
unfocuses. I would like the result to be similar to the Esc key with having
to select a cell. Possible? How?



Rick Rothstein \(MVP - VB\)

Command Buttons
 
After the user clicks the command button and
the code executes, the button is still focused.
In code I only know to place Range("A7").Select to unfocus the button.
Without this line the button remains focused. If you press the Esc key it
unfocuses. I would like the result to be similar to the Esc key with
having
to select a cell. Possible? How?


A kludge solution would be to add this line as the **last** line of your
Click event code...

SendKeys "{ESC}"

but I see nothing wrong with the "select a cell" method where you would make
this your **last** line of code...

ActiveCell.Select

Rick


ADK

Command Buttons
 
Thanks Ron

"Ron de Bruin" wrote in message
...
Hi ADK

See the TakeFocusOnClick property of the button


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"ADK" wrote in message
...
After the user clicks the command button and
the code executes, the button is still focused.
In code I only know to place Range("A7").Select to unfocus the
button.
Without this line the button remains focused. If you press the Esc key it
unfocuses. I would like the result to be similar to the Esc key with
having
to select a cell. Possible? How?




Dave Peterson

Command Buttons
 
You had a response at your other post.

ADK wrote:

After the user clicks the command button and
the code executes, the button is still focused.
In code I only know to place Range("A7").Select to unfocus the button.
Without this line the button remains focused. If you press the Esc key it
unfocuses. I would like the result to be similar to the Esc key with having
to select a cell. Possible? How?


--

Dave Peterson


All times are GMT +1. The time now is 11:38 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com