Relocate 方法

       

在大纲视图中,将指定区域中各段移至下一个可见段落之后或上一个可见段落之前。仅当正文在大纲视图中已经折叠或是该区域的一部分时,正文才与标题同时移动。

expression.Relocate(Direction)

expression   必需。该表达式返回“应用于”列表中的一个对象。

Direction  必需,WdRelocate。移动的方向。

示例

本示例将活动文档的第三、四、五段移至下一段(第六段)之后。

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

本示例将选定区域的首段移至上一段之前。

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