Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Determine ActiveControl on a multipage (tab) control
How can I determine what the "ActiveControl" is when the control is on a
multipage (tab) control? Is there a way to iterate through the control on the multipage tab and determine which one has the focus? Dale -- Don''t forget to rate the post if it was helpful! email address is invalid Please reply to newsgroup only. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Determine ActiveControl on a multipage (tab) control
create a form/sheet level variable and in the tab click event set it
to the tab number clicked. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Determine ActiveControl on a multipage (tab) control
Sorry, I probably wasn't clear enough.
I've got a bunch of textboxes on a multipage control. Have a function that I want to work based on the "ActiveControl", but when I run the following code, it indicates that the "ActiveControl" is the multipage control, rather than the textbox that actually has the focus. I need to determine which textbox has the focus. Dale -- Don''t forget to rate the post if it was helpful! email address is invalid Please reply to newsgroup only. " wrote: create a form/sheet level variable and in the tab click event set it to the tab number clicked. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Determine ActiveControl on a multipage (tab) control
isn't there a GotFocus event for the textboxes? Just put code in each
of the got focus events, for every single control, that sets the ControlHasFocus variable to the name or Index of the control. That's how I would do it anyway. |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Determine ActiveControl on a multipage (tab) control
Sorry, I probably wasn't clear enough.
I've got a bunch of textboxes on a multipage control. Have a function that I want to work based on the "ActiveControl", but when I run the following code, it indicates that the "ActiveControl" is the multipage control, rather than the textbox that actually has the focus. I need to determine which textbox has the focus. I think this will give you what you want... MultiPage1.SelectedItem.ActiveControl.Name Rick |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Determine ActiveControl on a multipage (tab) control
Rick,
Exactly what I was looking for. What I finally ended up using is. Set ctrl = frm.ActiveControl While TypeOf ctrl Is msforms.MultiPage Set ctrl = ctrl.SelectedItem.ActiveControl Wend Thanks! -- Don''t forget to rate the post if it was helpful! email address is invalid Please reply to newsgroup only. "Rick Rothstein (MVP - VB)" wrote: Sorry, I probably wasn't clear enough. I've got a bunch of textboxes on a multipage control. Have a function that I want to work based on the "ActiveControl", but when I run the following code, it indicates that the "ActiveControl" is the multipage control, rather than the textbox that actually has the focus. I need to determine which textbox has the focus. I think this will give you what you want... MultiPage1.SelectedItem.ActiveControl.Name Rick |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Determine ActiveControl on a multipage (tab) control
I'm not sure I understand why you used a While/Wend loop. Since there is
only one ActiveControl on your UserForm, and only one selected Page on the MultiPage and only one ActiveControl on that selected Page, I don't see what you are looping through. Of course, I don't know what the rest of your program is doing, but (off the top of my head) it seems like this should do what I think your code snippet is attempting to do.... Set ctrl = frm.ActiveControl If TypeOf ctrl Is msforms.MultiPage Then Set ctrl = ctrl.SelectedItem.ActiveControl End If Do the above assumes, I guess, that you have more than one MultiPage control on your form and you want to work with whichever one is the currently ActiveControl. If, however, you only have one MultiPage control on your form, you should be able to set ctrl to its ActiveControl (on its selected Page) directly like this... Set ctrl = frm.MultiPage1.SelectedItem.ActiveControl (again, that was off the top of my head and untested) where you would use the name of your MultiPage control in place of the name MultiPage1 that I used. Rick "Dale Fye" wrote in message ... Rick, Exactly what I was looking for. What I finally ended up using is. Set ctrl = frm.ActiveControl While TypeOf ctrl Is msforms.MultiPage Set ctrl = ctrl.SelectedItem.ActiveControl Wend Thanks! -- Don''t forget to rate the post if it was helpful! email address is invalid Please reply to newsgroup only. "Rick Rothstein (MVP - VB)" wrote: Sorry, I probably wasn't clear enough. I've got a bunch of textboxes on a multipage control. Have a function that I want to work based on the "ActiveControl", but when I run the following code, it indicates that the "ActiveControl" is the multipage control, rather than the textbox that actually has the focus. I need to determine which textbox has the focus. I think this will give you what you want... MultiPage1.SelectedItem.ActiveControl.Name Rick |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
Determine ActiveControl on a multipage (tab) control
Okay, I thought about what you are doing some more and think you would want
my first suggested change, not the second one. That is, I think this... Set ctrl = frm.ActiveControl If TypeOf ctrl Is msforms.MultiPage Then Set ctrl = ctrl.SelectedItem.ActiveControl End If does what your last posted code (the one with the While/Wend loop) was trying to do. Rick "Rick Rothstein (MVP - VB)" wrote in message ... I'm not sure I understand why you used a While/Wend loop. Since there is only one ActiveControl on your UserForm, and only one selected Page on the MultiPage and only one ActiveControl on that selected Page, I don't see what you are looping through. Of course, I don't know what the rest of your program is doing, but (off the top of my head) it seems like this should do what I think your code snippet is attempting to do.... Set ctrl = frm.ActiveControl If TypeOf ctrl Is msforms.MultiPage Then Set ctrl = ctrl.SelectedItem.ActiveControl End If Do the above assumes, I guess, that you have more than one MultiPage control on your form and you want to work with whichever one is the currently ActiveControl. If, however, you only have one MultiPage control on your form, you should be able to set ctrl to its ActiveControl (on its selected Page) directly like this... Set ctrl = frm.MultiPage1.SelectedItem.ActiveControl (again, that was off the top of my head and untested) where you would use the name of your MultiPage control in place of the name MultiPage1 that I used. Rick "Dale Fye" wrote in message ... Rick, Exactly what I was looking for. What I finally ended up using is. Set ctrl = frm.ActiveControl While TypeOf ctrl Is msforms.MultiPage Set ctrl = ctrl.SelectedItem.ActiveControl Wend Thanks! -- Don''t forget to rate the post if it was helpful! email address is invalid Please reply to newsgroup only. "Rick Rothstein (MVP - VB)" wrote: Sorry, I probably wasn't clear enough. I've got a bunch of textboxes on a multipage control. Have a function that I want to work based on the "ActiveControl", but when I run the following code, it indicates that the "ActiveControl" is the multipage control, rather than the textbox that actually has the focus. I need to determine which textbox has the focus. I think this will give you what you want... MultiPage1.SelectedItem.ActiveControl.Name Rick |
#9
Posted to microsoft.public.excel.programming
|
|||
|
|||
Determine ActiveControl on a multipage (tab) control
Sorry, I didn't clarify.
It turns out that at least one of the textboxes I want to work with is on a multipage imbedded within another multipage. Thanks again. Dale -- Don''t forget to rate the post if it was helpful! email address is invalid Please reply to newsgroup only. "Rick Rothstein (MVP - VB)" wrote: Okay, I thought about what you are doing some more and think you would want my first suggested change, not the second one. That is, I think this... Set ctrl = frm.ActiveControl If TypeOf ctrl Is msforms.MultiPage Then Set ctrl = ctrl.SelectedItem.ActiveControl End If does what your last posted code (the one with the While/Wend loop) was trying to do. Rick "Rick Rothstein (MVP - VB)" wrote in message ... I'm not sure I understand why you used a While/Wend loop. Since there is only one ActiveControl on your UserForm, and only one selected Page on the MultiPage and only one ActiveControl on that selected Page, I don't see what you are looping through. Of course, I don't know what the rest of your program is doing, but (off the top of my head) it seems like this should do what I think your code snippet is attempting to do.... Set ctrl = frm.ActiveControl If TypeOf ctrl Is msforms.MultiPage Then Set ctrl = ctrl.SelectedItem.ActiveControl End If Do the above assumes, I guess, that you have more than one MultiPage control on your form and you want to work with whichever one is the currently ActiveControl. If, however, you only have one MultiPage control on your form, you should be able to set ctrl to its ActiveControl (on its selected Page) directly like this... Set ctrl = frm.MultiPage1.SelectedItem.ActiveControl (again, that was off the top of my head and untested) where you would use the name of your MultiPage control in place of the name MultiPage1 that I used. Rick "Dale Fye" wrote in message ... Rick, Exactly what I was looking for. What I finally ended up using is. Set ctrl = frm.ActiveControl While TypeOf ctrl Is msforms.MultiPage Set ctrl = ctrl.SelectedItem.ActiveControl Wend Thanks! -- Don''t forget to rate the post if it was helpful! email address is invalid Please reply to newsgroup only. "Rick Rothstein (MVP - VB)" wrote: Sorry, I probably wasn't clear enough. I've got a bunch of textboxes on a multipage control. Have a function that I want to work based on the "ActiveControl", but when I run the following code, it indicates that the "ActiveControl" is the multipage control, rather than the textbox that actually has the focus. I need to determine which textbox has the focus. I think this will give you what you want... MultiPage1.SelectedItem.ActiveControl.Name Rick |
#10
Posted to microsoft.public.excel.programming
|
|||
|
|||
Determine ActiveControl on a multipage (tab) control
Ah! Okay, I see... thanks for clarifying that.
Rick "Dale Fye" wrote in message ... Sorry, I didn't clarify. It turns out that at least one of the textboxes I want to work with is on a multipage imbedded within another multipage. Thanks again. Dale -- Don''t forget to rate the post if it was helpful! email address is invalid Please reply to newsgroup only. "Rick Rothstein (MVP - VB)" wrote: Okay, I thought about what you are doing some more and think you would want my first suggested change, not the second one. That is, I think this... Set ctrl = frm.ActiveControl If TypeOf ctrl Is msforms.MultiPage Then Set ctrl = ctrl.SelectedItem.ActiveControl End If does what your last posted code (the one with the While/Wend loop) was trying to do. Rick "Rick Rothstein (MVP - VB)" wrote in message ... I'm not sure I understand why you used a While/Wend loop. Since there is only one ActiveControl on your UserForm, and only one selected Page on the MultiPage and only one ActiveControl on that selected Page, I don't see what you are looping through. Of course, I don't know what the rest of your program is doing, but (off the top of my head) it seems like this should do what I think your code snippet is attempting to do.... Set ctrl = frm.ActiveControl If TypeOf ctrl Is msforms.MultiPage Then Set ctrl = ctrl.SelectedItem.ActiveControl End If Do the above assumes, I guess, that you have more than one MultiPage control on your form and you want to work with whichever one is the currently ActiveControl. If, however, you only have one MultiPage control on your form, you should be able to set ctrl to its ActiveControl (on its selected Page) directly like this... Set ctrl = frm.MultiPage1.SelectedItem.ActiveControl (again, that was off the top of my head and untested) where you would use the name of your MultiPage control in place of the name MultiPage1 that I used. Rick "Dale Fye" wrote in message ... Rick, Exactly what I was looking for. What I finally ended up using is. Set ctrl = frm.ActiveControl While TypeOf ctrl Is msforms.MultiPage Set ctrl = ctrl.SelectedItem.ActiveControl Wend Thanks! -- Don''t forget to rate the post if it was helpful! email address is invalid Please reply to newsgroup only. "Rick Rothstein (MVP - VB)" wrote: Sorry, I probably wasn't clear enough. I've got a bunch of textboxes on a multipage control. Have a function that I want to work based on the "ActiveControl", but when I run the following code, it indicates that the "ActiveControl" is the multipage control, rather than the textbox that actually has the focus. I need to determine which textbox has the focus. I think this will give you what you want... MultiPage1.SelectedItem.ActiveControl.Name Rick |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
ActiveControl returns "wrong" value if ctrl is on a multipage ctrl | Excel Programming | |||
MultiPage control | Excel Worksheet Functions | |||
Calendar Control & ActiveControl | Excel Programming | |||
Looking for eloquent solution: Determine of any control on a page of multipage has been altered (userform) | Excel Programming | |||
Set Focus Problem for textbox control on multipage control | Excel Programming |