Muokkaa

Jaa


Range.Relocate method (Word)

In outline view, moves the paragraphs within the specified range after the next visible paragraph or before the previous visible paragraph.

Syntax

expression. Relocate( _Direction_ )

expression Required. A variable that represents a Range object.

Parameters

Name Required/Optional Data type Description
Direction Required WdRelocate The direction of the move.

Remarks

Body text moves with a heading only if the body text is collapsed in outline view or if it is part of the range.

Example

This example moves the third, fourth, and fifth paragraphs in the active document below the next (sixth) paragraph.

theStart = ActiveDocument.Paragraphs(3).Range.Start 
theEnd = ActiveDocument.Paragraphs(5).Range.End 
Set myRange = ActiveDocument.Range(Start:=theStart, End:=theEnd) 
ActiveDocument.ActiveWindow.View.Type = wdOutlineView 
myRange.Relocate Direction:=wdRelocateDown

This example moves the first paragraph in the selection above the previous paragraph.

ActiveDocument.ActiveWindow.View.Type = wdOutlineView 
Selection.Paragraphs(1).Range.Relocate Direction:=wdRelocateUp

See also

Range Object

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.