select first sentence of paragraph

B

bbarger

I am trying to loop through the paragraphs of a document and
select in turn the first sentence of each paragraph, and
apply formatting.

The line below selects the whole paragraph:


Selection.MoveDown Unit:=wdParagraph, Extend:=wdSentence

Can anyone tell me how to select just the first sentence?
Or provide a link that demonstrates this?

Thanks,

Bob Barger
 
G

Greg Maxey

Bob,

Maybe something like:

Sub ScratchMacro()
Dim oPar As Paragraph
For Each oPar In ActiveDocument.Paragraphs
oPar.Range.Sentences(1).Bold = True
Next
End Sub
 
B

bbarger

Greg,

Thank you very much! This is just what I was looking for.

Bob


-->Bob,
-->
-->Maybe something like:
-->
-->Sub ScratchMacro()
-->Dim oPar As Paragraph
-->For Each oPar In ActiveDocument.Paragraphs
--> oPar.Range.Sentences(1).Bold = True
-->Next
-->End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top