![]() |
|
|
|
#1
|
||||
|
||||
|
Try:
Code:
Sub ReverseBold()
Application.ScreenUpdating = False
Dim Rng As Range, bBld As Boolean
Set Rng = Selection.Characters.First
With Rng
bBld = .Font.Bold
Do While .End < Selection.End
Do While .Characters.Last.Next.Font.Bold = bBld
If .End < Selection.End Then
.End = .End + 1
Else
Exit Do
End If
Loop
.Font.Bold = Not bBld
bBld = Not bBld
.Collapse wdCollapseEnd
Loop
End With
Application.ScreenUpdating = True
End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#2
|
|||
|
|||
|
Thanks Paul. Again, your code works but it seems to take a long time. For a four line sentence it takes 20+ seconds to change the bold. Doesn't that seem like a long time??
|
|
#3
|
||||
|
||||
|
Quote:
While Greg's code will probably do what you want, my approach avoids any potential interference with whatever other formatting your content might already have (including double-strikethrough).
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#4
|
|||
|
|||
|
Would it make a difference if there are a lot fields in these docs? I timed using it a couple times with either of the macro I found and the one that Paul wrote, and for a four sentence paragraph it actually took 20-25 seconds. Suggestions?
|
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Macro to find and replace headings in bold and underline
|
redzan | Word VBA | 4 | 02-13-2016 12:24 PM |
| Creating macro in 2007 to bold within quotes on the fly | marymaryt | Word VBA | 5 | 06-01-2015 06:55 AM |
| Macro Needed to bold specific lines and Macro to turn into CSV | anewteacher | Word VBA | 1 | 05-28-2014 03:59 PM |
| Macro to reverse a test string | Jennifer Murphy | Word VBA | 5 | 01-16-2014 03:19 PM |
| Format Bold in one line makes all lines bold | Nitte | Word | 2 | 02-07-2013 12:34 AM |