Excel 2003, can't setfocus in a textbox inside a multipage, tab key don work!

C

carlosla

HI,
After create a MS form multipage with 2 pages on sheet1,each page with 2
textboxes.I want the focus on the first textbox of the page as soon as the
page is selected. When I exit the design mode and change the pages, nothing
happens, even the tab key does not move the focus between the textboxes. Code
is below

Private Sub MultiPage1_Change()
If MultiPage1.Value = 0 Then
MultiPage1.Pages(MultiPage1.Value).TextBox1.SetFocus
Else
MultiPage1.Pages(MultiPage1.Value).TextBox3.SetFocus
End If

I tried to put this code like above (this button is outside the multipage).
If I click the button, nothing happen, but if I run from inside the VB it
setfocus.

Private Sub CommandButton1_Click()

If MultiPage1.Value = 0 Then
MultiPage1.Pages(MultiPage1.Value).TextBox1.SetFocus
Else
MultiPage1.Pages(MultiPage1.Value).TextBox3.SetFocus
End If

Any idea why it happens ?? If I use a MS frame instead a MS Multipage I have
no problem with this ...

Thanks for any help...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top