Cycle 属性示例Cycle property example

下面的示例定义一个**Frame** 的**Cycle** 属性和**** 页中的两个**Page** 对象。The following example defines the Cycle property for a Frame and two Page objects in a MultiPage.

若要使用此示例,请将此示例代码复制到窗体的 Declarations 部分。To use this example, copy this sample code to the Declarations portion of a form. 确保该窗体包含:Make sure that the form contains:

  • 一个名为"Frame1"的 FrameA Frame named Frame1.
  • 一个名为"MultiPage1"的 MultiPage ,该控件包含两个名称分别为"Page1"和"Page2"的对象。A MultiPage named MultiPage1 that contains two objects named Page1 and Page2.
  • 两个名称分别为"CommandButton1"和"CommandButton2"的 CommandButton 控件。Two CommandButton controls named CommandButton1 and CommandButton2.

在窗体中,个控件的框架和每个页面都会放置几个控件, 以便您可以看到周期如何影响框架多页的 tab 键次序。In the form, the Frame and each Page of the MultiPage place a couple of controls, so you can see how Cycle affects the tab order of the Frame and MultiPage.

用户应遍历这些控件,以观察 Cycle 如何影响键顺序。The user should tab through the controls to observe how Cycle affects the tab order. 按 CommandButton1 展开键顺序,以将 FramePage 对象中的控件包含在内。Pressing CommandButton1 extends the tab order to include controls in the Frame and Page objects. 按 CommandButton2 限制键顺序。Pressing CommandButton2 restricts the tab order.

Private Sub RestrictCycles() 
'Limit tab order for the Frame and Page objects 
 Frame1.Cycle = fmCycleCurrentForm 
 MultiPage1.Page1.Cycle = fmCycleCurrentForm 
 MultiPage1.Page2.Cycle = fmCycleCurrentForm 
End Sub 
Private Sub UserForm_Initialize() 
End Sub 
Private Sub CommandButton1_Click() 
'Extend tab order subforms (the Frame and Page 
 Frame1.Cycle = fmCycleAllForms 
 MultiPage1.Page1.Cycle = fmCycleAllForms 
 MultiPage1.Page2.Cycle = fmCycleAllForms 
End Sub 
Private Sub CommandButton2_Click() 
End Sub

支持和反馈Support and feedback

有关于 Office VBA 或本文档的疑问或反馈?Have questions or feedback about Office VBA or this documentation? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.