Cycle 属性示例

以下示例为 MultiPage 中的 Frame 和两个 Page 对象定义 Cycle 属性。

若要使用此示例,请将此示例代码复制到窗体的 Declarations 部分。 确保该窗体包含:

  • 一个名为"Frame1"的 Frame
  • 一个名为"MultiPage1"的 MultiPage ,该控件包含两个名称分别为"Page1"和"Page2"的对象。
  • 两个名称分别为"CommandButton1"和"CommandButton2"的 CommandButton 控件。

在窗体中,FrameMultiPage 的每个页面都放置了几个控件,因此可以看到 Cycle 如何影响 FrameMultiPage 的 Tab 键顺序。

用户应遍历这些控件,以观察 Cycle 如何影响键顺序。 按 CommandButton1 展开键顺序,以将 FramePage 对象中的控件包含在内。 按 CommandButton2 限制键顺序。

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() 
 RestrictCycles 
End Sub 
 
Private Sub CommandButton1_Click() 
'Extend tab order subforms (the Frame and Page 
'objects) 
 Frame1.Cycle = fmCycleAllForms 
 MultiPage1.Page1.Cycle = fmCycleAllForms 
 MultiPage1.Page2.Cycle = fmCycleAllForms 
End Sub 
 
Private Sub CommandButton2_Click() 
 RestrictCycles 
End Sub

支持和反馈

有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。