Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / January 2005

Tip: Looking for answers? Try searching our database.

select first sentence of paragraph

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
bbarger - 01 Jan 2005 03:55 GMT
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
Greg Maxey - 01 Jan 2005 04:12 GMT
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

Signature

Greg Maxey/Word MVP
A Peer in Peer to Peer Support

> I am trying to loop through the paragraphs of a document and
> select in turn the first sentence of each paragraph, and
[quoted text clipped - 10 lines]
>
> Bob Barger
bbarger - 01 Jan 2005 04:23 GMT
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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.