![]() |
#19
|
||||
|
||||
![]()
This version will highlight each paragraph that contains a 1,000th word. It is more accurate on what it thinks a Word is.
Code:
Sub TagEvery1000thWordParagraph() Dim DocSrc As Document, lCount As Long, lDocLength As Long, aRng As Range Set DocSrc = ActiveDocument DocSrc.Range.HighlightColorIndex = wdNoHighlight lDocLength = DocSrc.Range.End - 2 Set aRng = DocSrc.Paragraphs(1).Range Do Until aRng.End > lDocLength lCount = lCount + 1000 Do Until aRng.ComputeStatistics(wdStatisticWords) > lCount Or aRng.End > lDocLength aRng.MoveEnd Unit:=wdParagraph, Count:=1 Loop aRng.Paragraphs.Last.Range.HighlightColorIndex = wdRed Loop aRng.Paragraphs.Last.Range.HighlightColorIndex = wdNoHighlight 'remove the last para highlight End Sub
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to find (highlight) two and more words in a list of 75k single words in Word 2010 | Usora | Word | 8 | 05-29-2018 03:34 AM |
![]() |
sharkrfish | Word | 2 | 05-21-2015 04:47 PM |
Redirect mail in batches in Office for MAC 2011 | mervalong | Outlook | 0 | 11-08-2011 12:17 AM |
![]() |
aligahk06 | Drawing and Graphics | 1 | 10-08-2009 12:58 AM |
![]() |
dlawson | Word | 4 | 04-14-2009 12:22 PM |