button focus
Hello, Need to know how to tell if a button has the focus.
thanks bill |
button focus
I don't know a way to do it in Excel VBA. But if you want a control to get the focus, you can use "SetFocus".
But even if there is a way to do it, I don't know how it can be applied. Maybe you can share with us why you need to do that. ----- billq wrote: ----- Hello, Need to know how to tell if a button has the focus. thanks bill |
button focus
Set a flag in code when the button is clicked, reset the flag when
something else (another control, a worksheet cell, etc as appropriate) is selected. Then, to know if the button has the focus, test the flag. "billq" wrote in message ... Hello, Need to know how to tell if a button has the focus. thanks bill |
button focus
Hi and thanks for the reply. I have a combination of cells, command
buttons, and radio buttons that I am trying to set up a tab order using Application.OnKey("{TAB}", "tabPress" to capture the tab key. For tabPress I am using if then, elseif structure to determine the active cell or button and where to move the focus. ex) if ActiveCell = Range("AccountNumber") then Application.Goto Reference "Amount" else if ActiveCell = Range("Amount") then Sheet1.CashRB.Activate else if Sheet1.CashRB 'this is where I need to determine if the control has the focus so that I can move the focus to the next control how this give you more idea as to what I am trying to do. If I had to do it all over again I would make this sheet a form by itself. thanks bill "billq" wrote in message ... Hello, Need to know how to tell if a button has the focus. thanks bill |
button focus
Something like:
Private m_blnHasFocusCashRB If m_blnHasFocusCashRB Then Application.Goto Reference "AccountNumber" m_blnHasFocusCashRB = False Else If ActiveCell = Range("AccountNumber") then Application.Goto Reference "Amount" else if ActiveCell = Range("Amount") then Sheet1.CashRB.Activate m_blnHasFocusCashRB = True End if End if "billQ" wrote in message ... Hi and thanks for the reply. I have a combination of cells, command buttons, and radio buttons that I am trying to set up a tab order using Application.OnKey("{TAB}", "tabPress" to capture the tab key. For tabPress I am using if then, elseif structure to determine the active cell or button and where to move the focus. ex) if ActiveCell = Range("AccountNumber") then Application.Goto Reference "Amount" else if ActiveCell = Range("Amount") then Sheet1.CashRB.Activate else if Sheet1.CashRB 'this is where I need to determine if the control has the focus so that I can move the focus to the next control how this give you more idea as to what I am trying to do. If I had to do it all over again I would make this sheet a form by itself. thanks bill "billq" wrote in message ... Hello, Need to know how to tell if a button has the focus. thanks bill |
All times are GMT +1. The time now is 04:36 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com