Reputation: 4845
How can I get a line from a Word document using the Selection object in VBA? Something like this:
Selection.MoveDown Unit:=wdLine, Count:=15
'print the 15th line here
EDIT: When i do:
Selection.MoveDown Unit:=wdLine, Count:=15
MsgBox (Selection.Text)
It prints only the first character of the line.
Upvotes: 3
Views: 30456
Reputation: 91346
You need to expand the selection:
Selection.MoveDown Unit:=wdLine, Count:=15
Selection.Expand wdLine
MsgBox (Selection.Text)
Upvotes: 9