Oh ye of little faith ;-)
Create a simple multipage form (page 0 and page 1). Add two textboxes to
page 0 and two text boxes and a combobox on page 1. Name the combobox
cbFirst.
Logically the following should work but it doesn't. When you tab from the
second textbox on page 0 theExit event "does not" fire and the focus shifts
to the page tab. You have to mouse off the tab for the Exit event to fire
:-(
Option Explicit
Private Sub UserForm_Initialize()
Me.MultiPage1.Value = 0
End Sub
Private Sub TextBox2_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Me.MultiPage1.Value = 1
Me.cbFirst.SetFocus
End Sub
However, with some added trickery you can force it to work. Add another
textbox textTiny to the page 0 control. Size it 1 point x 1 point with flat
effect (it has to be set to visible but you won't see it). Now run the same
code.
With the added control the Exit event fires as expected and the focus jumps
to the cbFirst on page 1.
Is this what you are looking for?
Patrick,
Sorry to be the bearer of bad news, but in my extensive experience
with MultiPage controls, I have never found a way to set focus to a
control on another page and, most especially, to cause a different
page to be displayed through code. It just doesn't seem to work, and
I don't hold much hope for success in your endeavour.
--
Greg Maxey
See my web site
http://gregmaxey.mvps.org
for an eclectic collection of Word Tips.
"It is not the critic who counts, not the man who points out how the
strong man stumbles, or where the doer of deeds could have done them
better. The credit belongs to the man in the arena, whose face is
marred by dust and sweat and blood, who strives valiantly...who knows
the great enthusiasms, the great devotions, who spends himself in a
worthy cause, who at the best knows in the end the triumph of high
achievement, and who at the worst, if he fails, at least fails while
daring greatly, so that his place shall never be with those cold and
timid souls who have never known neither victory nor defeat." - TR