I am looking for a way to determine the style of a paragraph following the
current selection object. In short, if the paragraph following the
selection object is a certain style, I need to move the end of the selection
object to the end of that paragraph. Initially my plan was to add the
paragraph and test the style (strStyle = Selection.ParagraphFormat.Style),
however, if more than one paragraph is in the selection object, strStyle is
"Nothing". (This makes sense if there are multiple styles in the
selection.)
Is there a way to way to get the Paragraph number of the current selection
and then test Paragraph (number+1)?
Unfortunately, I am a relative newbie to Word VBA, so only really know how
to work selection objects. But in this case I almost need two.
Any suggestions, references, links, comments, etc. will be greatly
appreciated!
Thanks!
Don
Edward Thrashcort - 24 Aug 2005 22:58 GMT
strStyle = Selection.Paragraphs.Last.Style
Eddie
> I am looking for a way to determine the style of a paragraph following the
> current selection object. In short, if the paragraph following the
[quoted text clipped - 19 lines]
>
> Don
Jezebel - 24 Aug 2005 23:24 GMT
You need to create a range to point to the text immediately following the
selection:
If ActiveDocument.Range(Selection.Range.End + 1, Selection.Range.End +
1).Style = strStyle then
...
You might want to add some error handling in case the Selection includes the
end of document.
>I am looking for a way to determine the style of a paragraph following the
> current selection object. In short, if the paragraph following the
[quoted text clipped - 19 lines]
>
> Don
Don - 25 Aug 2005 14:34 GMT
strStyle = Selection.Paragraphs.Last.Style did the trick!
Thanks!
Don
>I am looking for a way to determine the style of a paragraph following the
> current selection object. In short, if the paragraph following the
[quoted text clipped - 19 lines]
>
> Don