switching tab pages???

buckau

Registered User.
Local time
Tomorrow, 04:53
Joined
Feb 19, 2009
Messages
23
I have a user form that has several tab pages on it when the form opens it checks to see if the user has entered there default info if it is empty it needs to go to the default tab so the user can enter there info.
How do I do this using vba in excel 2000 I have not been able to find any code that will do this if I use the set focus option for a text box on the tab page it comes up with an error saying the item is not visible!
The user forme is names = UserDataInputForm
The tab pages I have are
1st = InputDailyTimesPage
2nd = OverTimePage
3rd = DataPage
4th = DefultDataPage
the form opens using the 1st tab page by default
in the user forms inisilisation code I have this check

'User name
If WsConst.Cells(4, 8).Value > 0 Then
'Retreve employee data
Me.EmployeeNameBox = WsConst.Cells(4, 8).Value
Else
MsgBox "Please enter Your Full Name"
Me.EmployeeNameBox.Locked = False
Me.EmployeeNameBox.TabStop = True
Me.EmployeeNobox.Locked = False
Me.EmployeeNobox.TabStop = True
Me.EmployeeNameBox.SetFocus
Exit Sub
End If
But is the “Me.EmployeeNameBox.SetFocus” that’s not working
How can I switch the focus to the “DefultDataPage”
 
I couldn't tell you off hand right now...

But from memory it's something like....

Sheets("DefaultDataPage").EmployeeNameBox.SetFocus

Something like that.

Excel has a fairly extensive help library for VBA. And if all else fails, record a macro and have a look at the code it generates.
 
hi thanks for the info but i managed to figer it out
the code is
Code:
        'Select page 3 = "DefultDataPage"
        MultiPage1.Value = 3

3 is the index of the tab that you wish to go to
 
Oh sorry!

I read the problem wrong....

I overlooked the bit that you said there was a Userform with TabPages. I thought it was the page tabs of the excel sheets!

Again, my apologies.
 

Users who are viewing this thread

Back
Top Bottom