View Single Post
 
Old 07-12-2024, 07:43 AM
gmaxey gmaxey is offline Windows 10 Office 2019
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,598
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

Code:
Sub BoldTextWithinBrackets_AddQuotes()
Dim oRng As Range
  Set oRng = ActiveDocument.Range
  Application.ScreenUpdating = False
  With oRng.Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Wrap = wdFindStop
    .Format = True
    .MatchWildcards = False
    .Font.Bold = True
    While .Execute
      oRng.Select
      If oRng.Characters.First.Previous = Chr(40) And oRng.Characters.Last.Next = Chr(41) Then
        oRng.InsertBefore Chr(34)
        oRng.Characters.First.Font.Bold = True
        oRng.InsertAfter Chr(34)
      End If
      oRng.Collapse wdCollapseEnd
    Wend
  End With
  Application.ScreenUpdating = True
lbl_Exit:
  Exit Sub
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote