Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 169
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 169
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,202
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 169
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,202
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,202
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 169
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,202
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
ActiveControl returns "wrong" value if ctrl is on a multipage ctrl Dale Fye Excel Programming 3 October 15th 07 04:26 PM
MultiPage control Patrick Simonds Excel Worksheet Functions 1 August 5th 06 05:32 PM
Calendar Control & ActiveControl Marcus B Excel Programming 0 March 15th 06 10:08 AM
Looking for eloquent solution: Determine of any control on a page of multipage has been altered (userform) KR Excel Programming 0 December 13th 04 09:04 PM
Set Focus Problem for textbox control on multipage control ExcelDeveloperSPR Excel Programming 1 July 16th 04 08:54 PM


All times are GMT +1. The time now is 05:31 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"