Word) (Document.StoryRanges 屬性

會傳回代表指定的文件中的所有本文的 StoryRanges 集合。 唯讀。

語法

expressionStoryRanges

表達 代表 Document 物件的變數。

註解

如需傳回集合中單一成員的資訊,請參閱 從集合傳回物件

範例

本範例會逐一 StoryRanges 集合,以判斷 wdPrimaryFooterStory 是否屬於 StoryRanges 集合。

For Each aStory In ActiveDocument.StoryRanges 
 If aStory.StoryType = wdEvenPagesFooterStory Then 
 MsgBox "Document includes an even page footer" 
 End If 
Next aStory

本範例會將文字加入主要標頭本文,然後顯示文字。

ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary).Range _ 
 .Text = "Header text" 
MsgBox ActiveDocument.StoryRanges(wdPrimaryHeaderStory).Text

另請參閱

Document 物件

支援和意見反應

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