![]() |
|
#2
|
||||
|
||||
|
Your code suggests you want to toggle the bold attribute for 'Synopsis' in the 'Body Text' Style, not simply make it all bold or all not bold. In that case, you could use a macro like:
Code:
Sub Demo()
Application.ScreenUpdating = False
Dim Rng As Range
With Selection
Set Rng = .Range
With .Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = "Synopsis"
.Replacement.Text = "^&"
.Style = "Body Text"
.Forward = True
.Wrap = wdFindStop
.Format = True
.MatchCase = True
.MatchWholeWord = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Execute
End With
Do While .Find.Found
.Font.Bold = wdToggle
.Collapse wdCollapseEnd
.Find.Execute
Loop
End With
Rng.Select
Set Rng = Nothing
Application.ScreenUpdating = True
End Sub
Code:
Sub Demo()
Application.ScreenUpdating = False
With Selection
With .Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = "Synopsis"
.Replacement.Text = "^&"
.Style = "Body Text"
.Replacement.Font.Bold = True
.Forward = True
.Wrap = wdFindStop
.Format = True
.MatchCase = True
.MatchWholeWord = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Execute Replace:=wdReplaceAll
End With
End With
Application.ScreenUpdating = True
End Sub
.Replacement.Font.Bold = True to: .Replacement.Font.Bold = False
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
| Tags |
| macro find text |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Select a area in a Word Document
|
Peter Stahl | Word VBA | 2 | 08-09-2013 03:18 AM |
Unable to Select Multiple folders in Outlook 2007 Advance Find
|
gregory | Outlook | 2 | 04-28-2012 10:53 PM |
Select statement to a new document
|
ishaw | Word | 1 | 10-17-2011 02:23 AM |
| Unable to select anything in an MS Word Document | PaulT | Word | 0 | 08-08-2011 07:45 PM |
Select printer to document
|
JosL | Office | 3 | 03-07-2009 12:40 PM |