Thread: [Solved] Reverse Bold macro
View Single Post
 
Old 02-24-2016, 02:01 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
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

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]
Reply With Quote