Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Focus
I suspect this is possible to do in VBA but I am at a loose end on ho
it is done. On a userForm that has multiple objects in multiple frames, is i possible to find out which object at any particular time, irrespectiv of which frame it is in, has currently got the focus ? Any ideas? Thanks in advance R -- Message posted from http://www.ExcelForum.com |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Focus
Hi RM
In theory (this demo click the form surface outside controls to run): Private Sub UserForm_Click() MsgBox Me.ActiveControl.Name End Sub Problems arise when you use containers, frames and multipages, which I understand youn will. They will be the active control and you have to dig for THEIR active control. The approach would be like this Private Sub UserForm_Click() On Error Resume Next MsgBox Me.ActiveControl.Name MsgBox Me.Controls(Me.ActiveControl.Name).ActiveControl.N ame End Sub now you decide how many levels deep are needed and which errors to trap if there are fewer levels when you search. Problem is probably not that big when you know what this is for and when it's gonna run. HTH. Best wishes Harald "Roy Miller " skrev i melding ... I suspect this is possible to do in VBA but I am at a loose end on how it is done. On a userForm that has multiple objects in multiple frames, is it possible to find out which object at any particular time, irrespective of which frame it is in, has currently got the focus ? Any ideas? Thanks in advance R M --- Message posted from http://www.ExcelForum.com/ |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Focus
This looks about right, I will try it out when I get back off holiday.
Roy --- Message posted from http://www.ExcelForum.com/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
focus | Excel Discussion (Misc queries) | |||
set focus | Excel Discussion (Misc queries) | |||
focus? | Excel Programming | |||
How do I set focus | Excel Programming | |||
set focus | Excel Programming |