![]() |
|
|
|
#1
|
||||
|
||||
|
The only paragraphs that would be affected are those following a paragraph containing your 'trigger' text. Obviously, if you have multiple consecutive paragraphs containing that text, they'd all be capitalised.
For a large document with many items to process, it's beneficial to yield time to the operating system periodically. Accordingly, try: Code:
Sub Demo()
Application.ScreenUpdating = False
Dim i As Long
With ActiveDocument.Range
With .Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = InputBox("What is the Text to Find")
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Execute
End With
Do While .Find.Found
i = i + 1
If i Mod 100 = 0 Then DoEvents
.Paragraphs.Last.Next.Range.Font.AllCaps = True
.Start = .Paragraphs.Last.Range.End
.Find.Execute
Loop
End With
Application.ScreenUpdating = True
End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Outlook search not finding recent mail; rebuild ix did nothing | PeterA | Outlook | 0 | 01-19-2017 12:27 AM |
Need some vba code to search a word document an replace it if len = 3
|
Belleke | Word VBA | 3 | 10-24-2016 01:00 AM |
Finding more than one word using "find" or using a vba code
|
capitala | Word VBA | 1 | 02-03-2014 06:45 PM |
Outlook 2010 Search not finding all items
|
gdrunner | Outlook | 2 | 03-10-2013 06:48 PM |
| Outlook 2010 search not finding everything | rexracer | Outlook | 5 | 07-21-2011 02:31 AM |