View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
onedaywhen onedaywhen is offline
external usenet poster
 
Posts: 459
Default 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