View Full Version : [SOLVED:] Selection with VBA for Word
lamnbj
05-12-2022, 08:48 PM
Line 1
Line 2
Line 3
Line 4
......
the end
I have a multi-page text. Is there a way to choose from the 4th line down at the end of that text? Thank you all.
macropod
05-12-2022, 09:12 PM
Yes, but we'd need to know a lot more about the document structure and the content you're working with.
gmaxey
05-14-2022, 05:42 AM
If by line, you mean paragraph and if you mean the fourth line on page one then:
Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
Dim oRng As Range
Set oRng = ActiveDocument.Range.Paragraphs(4).Range
oRng.Collapse wdCollapseEnd
oRng.End = ActiveDocument.Range.End
oRng.Select
lbl_Exit:
Exit Sub
End Sub
... however, as Paul states, that works on the very limited conditions given.
lamnbj
05-14-2022, 11:19 PM
Ok, thank you gmaxey
Aussiebear
05-15-2022, 02:29 PM
@lamnbj Has either of Paul's or Greg's responses been helpful? if not, can you indicate where they seem to come unstuck?
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.