Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How can I check if the ActiveSheet has keyboard focus?
What I'm trying to accomplish is essentially the following:
If ActiveSheet.IsKeyboardFocused = True Then [Do Something] End If Unfortunately, ActiveSheet/Worksheet does not have the IsKeyboardFocused property (I pulled this property from a Button control as a functional example). Is there a way to accomplish this If statement? Thanks, Matt |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How can I check if the ActiveSheet has keyboard focus?
hi
the keyboard is just another input device like the mouse. or the bar coded reader. how do you determine if the mouse has "focus"?? well...you don't know unitl a button(key) is pressed then the input device has "focus". if the keyboard has "focuss" then we may be talking about "keyboard shortcuts" which does cause code to run i.e. do something. I think that is why we don't seem to have "isKeyboardFocused" property or a "ismousefocused" property. having been confused by your post, could you explain further just what your are trying to accomplish? regards FSt1 "Matt" wrote: What I'm trying to accomplish is essentially the following: If ActiveSheet.IsKeyboardFocused = True Then [Do Something] End If Unfortunately, ActiveSheet/Worksheet does not have the IsKeyboardFocused property (I pulled this property from a Button control as a functional example). Is there a way to accomplish this If statement? Thanks, Matt |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
How can I check if the ActiveSheet has keyboard focus?
Hi and thanks for the reply. I'm less concerned about the keyboard
specifically, and more interested to see if there is a way to check if a sheet (any sheet) has focus. One thing I thought of is to check the value of ActiveSheet, however this doesn't always work because ActiveSheet has a value even when the Options Dialog is open (or any other dialog for that matter). It also has a value while editing within a cell. Do you know if there is a way to accomplish the following: If ActiveSheet.HasFocus = True Then [Do Something] End If Thanks for the help! Matt "FSt1" wrote: hi the keyboard is just another input device like the mouse. or the bar coded reader. how do you determine if the mouse has "focus"?? well...you don't know unitl a button(key) is pressed then the input device has "focus". if the keyboard has "focuss" then we may be talking about "keyboard shortcuts" which does cause code to run i.e. do something. I think that is why we don't seem to have "isKeyboardFocused" property or a "ismousefocused" property. having been confused by your post, could you explain further just what your are trying to accomplish? regards FSt1 "Matt" wrote: What I'm trying to accomplish is essentially the following: If ActiveSheet.IsKeyboardFocused = True Then [Do Something] End If Unfortunately, ActiveSheet/Worksheet does not have the IsKeyboardFocused property (I pulled this property from a Button control as a functional example). Is there a way to accomplish this If statement? Thanks, Matt |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
How can I check if the ActiveSheet has keyboard focus?
hi
i think you are trying to make this WAY more complicated that it is. active = focus. i can't understand what would be gained by looping through the sheets to see which one is active. if i need to do something on a certain sheet then... sheets("sheet1").activate now sheet 1 has focus. run code. back to my question. what are you trying to achieve? why are we trying to find the active sheet? technically the sheet your are looking at on the screen is the active sheet. confused here. please help. regards FSt1 regards FSt1 "Matt" wrote: Hi and thanks for the reply. I'm less concerned about the keyboard specifically, and more interested to see if there is a way to check if a sheet (any sheet) has focus. One thing I thought of is to check the value of ActiveSheet, however this doesn't always work because ActiveSheet has a value even when the Options Dialog is open (or any other dialog for that matter). It also has a value while editing within a cell. Do you know if there is a way to accomplish the following: If ActiveSheet.HasFocus = True Then [Do Something] End If Thanks for the help! Matt "FSt1" wrote: hi the keyboard is just another input device like the mouse. or the bar coded reader. how do you determine if the mouse has "focus"?? well...you don't know unitl a button(key) is pressed then the input device has "focus". if the keyboard has "focuss" then we may be talking about "keyboard shortcuts" which does cause code to run i.e. do something. I think that is why we don't seem to have "isKeyboardFocused" property or a "ismousefocused" property. having been confused by your post, could you explain further just what your are trying to accomplish? regards FSt1 "Matt" wrote: What I'm trying to accomplish is essentially the following: If ActiveSheet.IsKeyboardFocused = True Then [Do Something] End If Unfortunately, ActiveSheet/Worksheet does not have the IsKeyboardFocused property (I pulled this property from a Button control as a functional example). Is there a way to accomplish this If statement? Thanks, Matt |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
How can I check if the ActiveSheet has keyboard focus?
" if i need to do something on a certain sheet then...
sheets("sheet1").activate" If I want to do something on that sheet, I'd do something like this Dim myWS as Excel.worksheet Set myWS = Worksheets("Sheet1") myWS.Cells(1,1).value = "enter Value" Blah blah blah. YOu generally don't need to activate anything to make changes to any sheet. Besides, doing all that activating and selecting is slow. "FSt1" wrote: hi i think you are trying to make this WAY more complicated that it is. active = focus. i can't understand what would be gained by looping through the sheets to see which one is active. if i need to do something on a certain sheet then... sheets("sheet1").activate now sheet 1 has focus. run code. back to my question. what are you trying to achieve? why are we trying to find the active sheet? technically the sheet your are looking at on the screen is the active sheet. confused here. please help. regards FSt1 regards FSt1 "Matt" wrote: Hi and thanks for the reply. I'm less concerned about the keyboard specifically, and more interested to see if there is a way to check if a sheet (any sheet) has focus. One thing I thought of is to check the value of ActiveSheet, however this doesn't always work because ActiveSheet has a value even when the Options Dialog is open (or any other dialog for that matter). It also has a value while editing within a cell. Do you know if there is a way to accomplish the following: If ActiveSheet.HasFocus = True Then [Do Something] End If Thanks for the help! Matt "FSt1" wrote: hi the keyboard is just another input device like the mouse. or the bar coded reader. how do you determine if the mouse has "focus"?? well...you don't know unitl a button(key) is pressed then the input device has "focus". if the keyboard has "focuss" then we may be talking about "keyboard shortcuts" which does cause code to run i.e. do something. I think that is why we don't seem to have "isKeyboardFocused" property or a "ismousefocused" property. having been confused by your post, could you explain further just what your are trying to accomplish? regards FSt1 "Matt" wrote: What I'm trying to accomplish is essentially the following: If ActiveSheet.IsKeyboardFocused = True Then [Do Something] End If Unfortunately, ActiveSheet/Worksheet does not have the IsKeyboardFocused property (I pulled this property from a Button control as a functional example). Is there a way to accomplish this If statement? Thanks, Matt |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
How can I check if the ActiveSheet has keyboard focus?
hi
your are right and i do use that as often as possible. so maybe i wasn't thinking as clearly as i should have. thank you. but the point remains.....why are we trying to find the active sheet when the sheet we are looking at IS then active sheet. and why does it matter since we can perform actions on other sheets (as you have pointed out). so the question remains..... what are you trying to achieve? why are we trying to find the active sheet? confused. please help. i am sure there is a reason. educate me. or maybe i just need to shut up now and let it ride. sigh. regards FSt1 "Barb Reinhardt" wrote: " if i need to do something on a certain sheet then... sheets("sheet1").activate" If I want to do something on that sheet, I'd do something like this Dim myWS as Excel.worksheet Set myWS = Worksheets("Sheet1") myWS.Cells(1,1).value = "enter Value" Blah blah blah. YOu generally don't need to activate anything to make changes to any sheet. Besides, doing all that activating and selecting is slow. "FSt1" wrote: hi i think you are trying to make this WAY more complicated that it is. active = focus. i can't understand what would be gained by looping through the sheets to see which one is active. if i need to do something on a certain sheet then... sheets("sheet1").activate now sheet 1 has focus. run code. back to my question. what are you trying to achieve? why are we trying to find the active sheet? technically the sheet your are looking at on the screen is the active sheet. confused here. please help. regards FSt1 regards FSt1 "Matt" wrote: Hi and thanks for the reply. I'm less concerned about the keyboard specifically, and more interested to see if there is a way to check if a sheet (any sheet) has focus. One thing I thought of is to check the value of ActiveSheet, however this doesn't always work because ActiveSheet has a value even when the Options Dialog is open (or any other dialog for that matter). It also has a value while editing within a cell. Do you know if there is a way to accomplish the following: If ActiveSheet.HasFocus = True Then [Do Something] End If Thanks for the help! Matt "FSt1" wrote: hi the keyboard is just another input device like the mouse. or the bar coded reader. how do you determine if the mouse has "focus"?? well...you don't know unitl a button(key) is pressed then the input device has "focus". if the keyboard has "focuss" then we may be talking about "keyboard shortcuts" which does cause code to run i.e. do something. I think that is why we don't seem to have "isKeyboardFocused" property or a "ismousefocused" property. having been confused by your post, could you explain further just what your are trying to accomplish? regards FSt1 "Matt" wrote: What I'm trying to accomplish is essentially the following: If ActiveSheet.IsKeyboardFocused = True Then [Do Something] End If Unfortunately, ActiveSheet/Worksheet does not have the IsKeyboardFocused property (I pulled this property from a Button control as a functional example). Is there a way to accomplish this If statement? Thanks, Matt |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to change check box name using mouse and keyboard | Charts and Charting in Excel | |||
how can I check for cell focus inside a spreadsheet ? | Excel Worksheet Functions | |||
How do I get the focus on a check box? | New Users to Excel | |||
Check for Enter key and change focus? | Excel Programming | |||
Check if activesheet is protected | Excel Programming |