0
我搜索了網頁,結果沒有如何完成一項簡單的任務。 選擇一個命名範圍。我一直在指定範圍內的文本重複,而不是選擇。代碼註釋:Word 2010/2013 VBA - 將選擇設置爲命名範圍
Sub SetSelectionFromRange()
' Goal: Set current selection to be that of a named range
' text of doc is "One Two" and at start the insertion bar is between "w" and "o"
Dim myRange4 As Range
Set myRange4 = ActiveDocument.Range(Start:=0, End:=3)
Selection.Range = myRange4.Duplicate
' result expected is "One" selected and no change in text
' result actual is "One TwOneo" and insertion bar left after "w" (no selection)`
End Sub
完美。太簡單明瞭,讓我看到。非常感謝祖馬 – 2014-10-27 01:07:24