View Single Post
 
Old 09-18-2017, 11:21 PM
slaycock slaycock is offline Windows 7 64bit Office 2013
Expert
 
Join Date: Sep 2013
Posts: 255
slaycock is on a distinguished road
Default

Your code seems to select line 6 OK for me.

I followed the help at

https://msdn.microsoft.com/VBA/Word-...to-method-word

The problem seems to relate to the wdLine constant as

Code:
Set myRange = ActiveDocument.StoryRanges(wdMainTextStory).Characters(1)
myRange.MoveEnd unit:=wdWord
myRange.MoveEnd unit:=wdLine
selects the first word in the document but gives a bad parameter message when the unit is wdLine.
Reply With Quote