Tab Controls - Which tab is selected?

scottydel

Registered User.
Local time
Today, 11:00
Joined
Apr 18, 2007
Messages
35
Hello,

Is there a way within VBA to determine which tab the user has just clicked?

I am using the ON CHANGE event, and with this I can detect that the user has clicked any tab, and I can execute some code when this happens.

But I have some additional code I would like to only execute when the user clicks on one specific tab.

I looked in the Properties window of a Page object, but could only find an ON CLICK event. This event unfortunately only fires when the user clicks in the body of a page, and not on the tab across the top that is associated with that page. So the Page object's ON CLICK event is of no help to me.

Is there anything else exposed that is not part of the Properties window perhaps?

Any help would be appreciated!

Thanks,

Scott
 
You can either use this:

Me.YourTabControlName.Value
or
Me.YourTabControlName.Pages(Me.YourTabControlName.Value).Name

If you use this one
Me.YourTabControlName.Pages(Me.YourTabControlName.Value).Name

you can do something like this:

Select Case Me.YourTabControlName.Pages(Me.YourTabControlName.Value).Name
Case "MyPageName"
...do something here
Case "MyOtherPageName"
...do something here
End Select

but if you use this

Me.YourTabControlName.Value

You can do this

Select Case Me.YourTabControlName.Value
Case 0
...do something here
Case 1
...do something here
End Select
 
That worked wonderfully thank you.
 

Users who are viewing this thread

Back
Top Bottom