共用方式為


列舉、顯示、隱藏及放置功能窗格中的模組

Microsoft Outlook 中NavigationPane物件的NavigationModules屬性可讓您存取功能窗格所包含的流覽模組。 使用 Item 方法來列舉集合所包含的 NavigationModule 物件,因為 Item 方法是 NavigationModules 集合的預設屬性和索引子屬性。 CurrentModule屬性會決定目前在功能窗格中選取的NavigationModule物件。

此外,每個 NavigationModule 物件都具有一些相關屬性,可用於顯示、隱藏或變更功能窗格中各模組的顯示位置:

  • Visible 屬性會決定是否可以在功能窗格中顯示 NavigationModule 物件。

  • Position 屬性會決定在功能窗格中顯示 NavigationModule 物件時的序數位置。

The DisplayedModuleCount property of the NavigationPane object determines the number of visible NavigationModule objects that can be displayed by the Navigation Pane. 如果 NavigationModule 物件的 Visible 屬性設定為 False,或者如果 NavigationModule 物件的 Position 屬性是設成不讓模組成為功能窗格中,能夠顯示的可視 NavigationModule 物件之一,模組就不會顯示。 Microsoft Visual Basic for Applications (VBA) 中的下列程式碼範例包含 MoveCurrentModuleToTopMakeAllModulesVisible 程式。 此 MoveCurrentModuleToTop 程式會使用NavigationPane物件的CurrentModule屬性來擷取目前選取的NavigationModule物件,並將該NavigationModule物件的Position屬性設定為 1,使其成為功能窗格中顯示最上方的模組。 程式 MoveCurrentModuleToTop 會列舉NavigationPane物件的Modules集合,將集合中包含之每個NavigationModule物件的Visible屬性設定為True。 It finally sets the DisplayedModuleCount property of the NavigationPane object to the value of the Count property of the NavigationModules collection for the NavigationPane object, ensuring that every navigation module contained in the Navigation Pane is visible to the user.

Private Sub MoveCurrentModuleToTop() 
 
 Dim objPane As NavigationPane 
 
 ' Get the NavigationPane object for the 
 ' currently displayed Explorer object. 
 Set objPane = Application.ActiveExplorer.NavigationPane 
 
 ' Set the Position property of the currently selected 
 ' module to 1, making it the topmost module displayed 
 ' in the Navigation Pane. 
 objPane.CurrentModule.Position = 1 
End Sub 
 
Private Sub MakeAllModulesVisible() 
 
 Dim objPane As NavigationPane 
 Dim objModule As NavigationModule 
 
 ' Get the NavigationPane object for the 
 ' currently displayed Explorer object. 
 Set objPane = Application.ActiveExplorer.NavigationPane 
 
 ' This loop enumerates through the Modules collection, 
 ' setting the Visible property of each module to True. 
 For Each objModule In objPane.Modules 
 objModule.Visible = True 
 Next 
 
 ' Set the DisplayedModuleCount property to 
 ' display all modules contained by the 
 ' Navigation Pane. 
 objPane.DisplayedModuleCount = objPane.Modules.count 
End Sub

支援和意見反應

有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應