VBA Code for Word Navigation Pane 【failed】 view-showheading-method-word
https://msdn.microsoft.com/VBA/Word-VBA/articles/view-showheading-method-word
View.ShowHeading Method (Word)
|
1 Contributor
Shows all headings up to the specified heading level and hides subordinate headings and body text.
Syntax
expression . ShowHeading( Level )
expression Required. A variable that represents a View object.
Parameters
Name | Required/Optional | Data Type | Description |
---|---|---|---|
Level | Required | Long | The outline heading level (a number from 1 to 9). |
Remarks
This method generates an error if the view isn't outline view or master document view.
Example
This example switches the active window to outline view and displays all text that's formatted with the Heading 1 style. Body text and all other types of headings are hidden.
With ActiveDocument.ActiveWindow.View
.Type = wdOutlineView
.ShowHeading 1
End With
This example switches the window for Document1 to outline view and displays all text that's formatted with the Heading 1, Heading 2, or Heading 3 style.
With Windows("Document1").View
.Type = wdOutlineView
.ShowHeading 3
End With
【推荐】还在用 ECharts 开发大屏?试试这款永久免费的开源 BI 工具!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步