A
Alan
I want to get the Range of the "next" line (one down from current
cursor position), so I can determine if it is empty, and select it if
it is not empty.
I wrote the following code, but I am having two problems: It sets
the Range start properly only when the current line is selected (I
don't want to require this). Also, I am not sure how to find the
value of the end of the next line, so I know how to set the end of the
range.
Can anyone point me in the right direction? Thanks, Alan
Function GetNextLineRange() As Range
Dim Width As Long
Set GetNextLineRange = Selection.Range
Width = GetNextLineRange.End - GetNextLineRange.Start
Set GetNextLineRange = ActiveDocument.Range
(Start:=Selection.Range.End, End:=Selection.Range.End + Width)
MsgBox ("GetNextLineRange = " & GetNextLineRange.Text)
End Function
Sub TestGetNextLineRange()
GetNextLineRange
End Sub
cursor position), so I can determine if it is empty, and select it if
it is not empty.
I wrote the following code, but I am having two problems: It sets
the Range start properly only when the current line is selected (I
don't want to require this). Also, I am not sure how to find the
value of the end of the next line, so I know how to set the end of the
range.
Can anyone point me in the right direction? Thanks, Alan
Function GetNextLineRange() As Range
Dim Width As Long
Set GetNextLineRange = Selection.Range
Width = GetNextLineRange.End - GetNextLineRange.Start
Set GetNextLineRange = ActiveDocument.Range
(Start:=Selection.Range.End, End:=Selection.Range.End + Width)
MsgBox ("GetNextLineRange = " & GetNextLineRange.Text)
End Function
Sub TestGetNextLineRange()
GetNextLineRange
End Sub