Selecting Documents

The Documents collection starts at 1.

Application.Documents.Item(2) 
Application.Documents(2)
Application.Documents("Temp.doc")

Dim objDocument As Document 
objDocument = Application.ActiveDocument
objDocument = ActiveDocument

The ActiveDocument is read only and cannot be used to set the active document

Documents("Temp.doc").Activate 


WholeStory Method

The WholeStroy method expands a Range or Selection object to include the entire story
The following two lines are equivalent.

objRange.WholeStory 
objRange.Expand Unit:=wdUnits.wdStory


Content Property

The content property returns a Range object that represents the main document.
The following two lines are equivalent

ActiveDocument.Content.Select 
ActiveDocument.StoryRanges(wdStoryType.wdMainTextStory).Select


© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext