Range Object - Expanding


Expand

Expands the Range or Selection object by a particular unit.

objRange.Expand(Unit:=wdUnits.wdCharacter) 

Unit - The default is wdWord. The unit can only be one of the following constants:

objRange.Expand(Unit:=wdUnits.wdCell) 
objRange.Expand(Unit:=wdUnits.wdCharacter)
objRange.Expand(Unit:=wdUnits.wdColumn)
objRange.Expand(Unit:=wdUnits.wdParagraph)
objRange.Expand(Unit:=wdUnits.wdRow)
objRange.Expand(Unit:=wdUnits.wdSentence)
objRange.Expand(Unit:=wdUnits.wdSection)
objRange.Expand(Unit:=wdUnits.wdStory)
objRange.Expand(Unit:=wdUnits.wdTable)
objRange.Expand(Unit:=wdUnits.wdWord)

Using any other unit will generate a Bad Paramater error.
You can only use wdLine when using a Selection object.


This method returns a value (Long) that indicates the number of characters added to the Range.

objRange.Expand(Unit:=wdUnits.wdCharacter) 

The following expands the Range object to include another sentence

objRange.Expand(Unit:=wdUnits.wdSentence) 


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