__1. An individual Tab on a Tab Control is actually a Page Object. For this discussion, we will use the terms Tab/Page interchangeably, however.
__2. Each Page Object is a member of the Pages Collection which includes all Pages on a Tab Control.
__3. Each Page Object provides a Controls Collection which references all Controls on a specific Tab/Page.
__4. Now that you are thoroughly confused, there are basically 5 Methods for referring to an individual Tab on a Tab Control. We will be using the SetFocus Method to demonstrate this point.
ASSUMPTIONS:
__1. Tab Control name: TabCtl1
__2. Number of Tabs/Pages: 6
__3. Tab/Page Captions: Page1, Page2, Page3, Page4, Page5, Page6
__4. Tab/Page Names: pgeOne, pgeTwo, pgeThree, pgeFour, pgeFive, pgeSix
Expand|Select|Wrap|Line Numbers
- Method 1:
- Me!TabCtl1.Pages(0).SetFocus - set Focus to the 1st Tab
- Method 2:
- Me!TabCtl1.Pages!pgeThree.Setfocus - set Focus to 3rd Tab
- Method 3:
- Me!TabCtl1.Pages("pgeFour").Setfocus - set Focus to 4th Tab
- Method 4:
- Me!TabCtl1.Value = 4 - makes the 5th Tab active
- Method 5:
- SendKeys "%a" - makes the 6th Tab active (a is a 'Hot Key' in the Caption of this Tab.