R
Raphael Goubet
Hi,
A macro I'm writing includes the insertion of a section break at the
end of a selection:
ActiveDocument.Range(Start:=Selection.End,
End:=Selection.End).InsertBreak _
Type:=wdSectionBreakContinuous
Now, this will fail if the selection ranges to the very last position
in the document (the last, unerasable carriage return that appears
when hidden characters are shown), since a section break cannot be
inserted after the last character of the document.
So, I have to test that the selection does not go that far, as it
would is the user selects with shift-ctrl-End. Checking Selection.End
is useless, since the value of that property is unpredictable. If the
selection stops earlier, it's OK, otherwise, I'll insert my section
break at Selection.End-1.
How can I do it?
Thanks in advance.
Raph
A macro I'm writing includes the insertion of a section break at the
end of a selection:
ActiveDocument.Range(Start:=Selection.End,
End:=Selection.End).InsertBreak _
Type:=wdSectionBreakContinuous
Now, this will fail if the selection ranges to the very last position
in the document (the last, unerasable carriage return that appears
when hidden characters are shown), since a section break cannot be
inserted after the last character of the document.
So, I have to test that the selection does not go that far, as it
would is the user selects with shift-ctrl-End. Checking Selection.End
is useless, since the value of that property is unpredictable. If the
selection stops earlier, it's OK, otherwise, I'll insert my section
break at Selection.End-1.
How can I do it?
Thanks in advance.
Raph