![]() |
|
|
|
#1
|
|||
|
|||
|
Hi! Please, try this simple code:
Code:
Sub Format_If()
'Format as needed all paras that are preceded by an empty para and start with Mon, Tue, Wed, Thu, Fri, Sat, Sun plus space.
Dim myRng As range
Application.ScreenUpdating = False
Set myRng = ActiveDocument.range
With myRng.Find
.ClearFormatting
.Replacement.ClearFormatting
.text = "^13^13[FMSTW][aehoru][deintu] "
.Replacement.text = ""
.Forward = True
.Wrap = wdFindStop
.MatchWildcards = True
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
End With
Application.ScreenUpdating = False
Set myRng = Nothing
End Sub
|
|
#2
|
||||
|
||||
|
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
Code:
Do While .Execute
myRng.Paragraphs.Last.Range.Font.Bold = True
myRng.Paragraphs.Last.ange.Font.Size = 14
myRng.Collapse wdCollapseEnd
Loop
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#3
|
|||
|
|||
|
Yes, Macropod, I fully agree! Thank you for your useful remarks!
|
|
| Tags |
| formatting text, word vba |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Diary template | RobinClay | Word | 0 | 05-05-2023 03:22 PM |
| Formatting th at the end of ordinal dates | DBlomgren | Publisher | 0 | 01-23-2016 09:44 AM |
| Conditional Formatting Dates | Phil H | Excel | 6 | 12-08-2014 07:42 AM |
Conditional Formatting Dates
|
jake.harris5253 | Excel | 1 | 12-06-2014 10:59 AM |
| Conditional Formatting with Dates | namedujour | Excel | 1 | 02-21-2013 03:42 AM |