Article ID: 213254 - Last Review: November 23, 2006 - Revision: 3.5 XL2000: How to Use the TabStrip Control on a UserFormThis article was previously published under Q213254 On This PageSUMMARY
This article explains how to use the TabStrip control on a UserForm, and provides Microsoft Visual Basic for Applications sample code for this purpose.
MORE INFORMATIONMicrosoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact a Microsoft Certified Partner or Microsoft Advisory Services. For more information, visit these Microsoft Web sites: Microsoft Certified Partners - https://partner.microsoft.com/global/30000104 (https://partner.microsoft.com/global/30000104) Microsoft Advisory Services - http://support.microsoft.com/gp/advisoryservice (http://support.microsoft.com/gp/advisoryservice) For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site:http://support.microsoft.com/default.aspx?scid=fh;EN-US;CNTACTMS (http://support.microsoft.com/default.aspx?scid=fh;en-us;cntactms) Use a TabStrip control to view different sets of information for related controls. A TabStrip is recommended if you use a single layout for your data. For example, use different tabs in a TabStrip control to display different views for one group of controls. The TabStrip is implemented as a container of a Tabs collection, which, in turn, contains a group of Tab objects. By default, the control contains two Tab objects; you can add or remove Tab objects as needed. The client region of a TabStrip control is not a separate form. Rather, the client region is a portion of the form that contains the TabStrip control. The border of a TabStrip control defines a region of the form that you can associate with tabs. When you place a control in the client region of a TabStrip, you are adding a control to the form that contains the TabStrip. Adding a Tab Strip Control to a UserFormTo add a TabStrip control to a UserForm in the Visual Basic Editor, follow these steps:
Working with Existing Tabs in a TabStrip ControlTo select an individual tab in a TabStrip control, follow these steps:
Controlling a Tab Strip ProgrammaticallyUse the SelectedItem property of the TabStrip control to indicate which Tab object is selected in the TabStrip control at run time. For example, if you create a TabStrip control named TabStrip1, you can use the following statement to display the caption of the selected tab:MsgBoxTabStrip1.SelectedItem.Caption
The SelectedItem property is read-only and cannot be set at run time. If you need to programmatically set which tab is selected, set the Value property for the TabStrip control. The following example selects the third tab on a TabStrip named TabStrip1:
TabStrip1.Value=2 NOTE: The values of tabs in a TabStrip control start with 0 (zero). If the TabStrip control contains 3 tabs, their values are 0, 1, and 2.
ExampleTo create a simple UserForm that implements a TabStrip control, follow these steps:
REFERENCESFor more information about the TabStrip control, in the Visual Basic Editor, click Microsoft Visual Basic Help on the Help menu, type tabstrip control in the Office Assistant or the Answer Wizard, and then click Search to view the topic.
| Article Translations
|
Back to the top
