Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
userform1.activecontrol.name
Msgbox Userform1.ActiveControl.name
Does or should this work with controls on a multipage form? When I use it, all I get is "frame1". No matter which control is selected |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
userform1.activecontrol.name
If the control is contained within a frame control the Frame will be
the active control, which will in turn have its own ActiveControl. This code should resolve in the active control nested within frames: Dim Ctrl As MSForms.Control Set Ctrl = Me.ActiveControl Do Until Not TypeOf Ctrl Is MSForms.Frame Set Ctrl = Ctrl.ActiveControl Loop MsgBox "Active control = " & Ctrl.Name "Italian Job" wrote in message ... Msgbox Userform1.ActiveControl.name Does or should this work with controls on a multipage form? When I use it, all I get is "frame1". No matter which control is selected |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
userform1.activecontrol.name
Awesome. That code got me another level into it.
Unfortunately, it evaluates to "multipage1" now. I assume I should modify the code to loop through "not Multipage" also. Do you think I assembled this form inefficiently? "onedaywhen" wrote in message m... If the control is contained within a frame control the Frame will be the active control, which will in turn have its own ActiveControl. This code should resolve in the active control nested within frames: Dim Ctrl As MSForms.Control Set Ctrl = Me.ActiveControl Do Until Not TypeOf Ctrl Is MSForms.Frame Set Ctrl = Ctrl.ActiveControl Loop MsgBox "Active control = " & Ctrl.Name "Italian Job" wrote in message ... Msgbox Userform1.ActiveControl.name Does or should this work with controls on a multipage form? When I use it, all I get is "frame1". No matter which control is selected |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
userform1.activecontrol.name
Awesome. That code got me another level into it.
Unfortunately, it evaluates to "multipage1" now. I assume I should modify the code to loop through "not Multipage" also. Yes. Do you think I assembled this form inefficiently? Not necessarily. Organizing controls in frames and multipages, even if they are nested, is usually good organization from a GUI design point of view. However, this may your code more complex. If this is the case, consider writing some custom methods to access the controls. "Italian Job" wrote in message ... "onedaywhen" wrote in message m... If the control is contained within a frame control the Frame will be the active control, which will in turn have its own ActiveControl. This code should resolve in the active control nested within frames: Dim Ctrl As MSForms.Control Set Ctrl = Me.ActiveControl Do Until Not TypeOf Ctrl Is MSForms.Frame Set Ctrl = Ctrl.ActiveControl Loop MsgBox "Active control = " & Ctrl.Name "Italian Job" wrote in message ... Msgbox Userform1.ActiveControl.name Does or should this work with controls on a multipage form? When I use it, all I get is "frame1". No matter which control is selected |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro to filter dates using Userform1 & printing | Excel Discussion (Misc queries) | |||
ActiveControl problem | Excel Discussion (Misc queries) | |||
UserForm1.Textbox1.SetFocus Question | Excel Programming | |||
Userform1 Border | Excel Programming | |||
Userform1 Border | Excel Programming |