View Single Post
 
Old 04-07-2025, 03:22 PM
macropod's Avatar
macropod macropod is offline Windows 10 Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,387
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by vivka View Post
Hi! Please, try this simple code:
FWIW, your
Code:
        Do While .Execute
            myRng.start = myRng.start + 2
            myRng.Paragraphs(1).range.Font.Bold = True
            myRng.Paragraphs(1).range.Font.Size = 14
            myRng.Collapse wdCollapseEnd
        Loop
could be reduced to:
Code:
        Do While .Execute
            myRng.Paragraphs.Last.Range.Font.Bold = True
            myRng.Paragraphs.Last.ange.Font.Size = 14
            myRng.Collapse wdCollapseEnd
        Loop
Not using a loop is more efficient, though. Regardless, you're not testing for full dates, so there's a risk of spurious matches (e.g. 'May I go now', 'The quick brown fox', 'She went home').
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote