Tab Control & Page Index

  • Thread starter Thread starter dave h
  • Start date Start date
D

dave h

Hi,
I have a 6 tab tabcontrol and I need to know in my VBA code when the user
has selected a new tab. The tabcontrol Change() event seems to respond OK
to the user clicking a different tab. However, I'm unable to determine
which tab is now visible to the user. I thought the PageIndex property
would give me this. So I tried,

Private Sub TabCtl7_Change()
MsgBox ("tab change =" & Me.TabCtl7.Pages("addressPage").PageIndex)
End Sub

Each time the user clicks a new tab the message box responds OK, but it
always returns a valude of 1. i.e "tab change=1" is always displayed
regardless of which tab the user selects. The page property sheets DO show
uniques values from 0 to 5. Any one know why I'm not getting the proper
index values in my code?

BTW, I can't get the click() event for the page to fire under any
circumstances.

Thanks
 
Sorry about this - I've been trying lots of things and did not state part of
this problem correctly.

I do need to know what tab the user has selected and the tabcontrol() event
seems like the right place to find out. However, I realize that -
Me.TabCtl7.Pages("addressPage").PageIndex - will always return the same
index as 1 is the index of the addressPage. But my problem remains as I
can't seem to figure out how to get the currently selected PageIndex.
Things like TabCtl7.PageIndex or TabCtl7.Pages.PageIndex are not valid.
Thanks and sorry for the first posting error.
 
Back
Top