View Single Post
 
Old 06-14-2024, 04:34 AM
gmaxey gmaxey is offline Windows 10 Office 2019
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,617
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

Shelley


We will have to drop back and check each found instance to ensure is starts at the beginning of the paragraph.


Code:
Sub ScratchMacro()
'A basic Word Macro coded by Gregory K. Maxey
Dim oRng As Range
  Set oRng = ActiveDocument.Range
  With oRng.Find
    .ClearFormatting
    .Forward = True
    .Wrap = wdFindStop
    .Format = True
    .MatchWildcards = True
    .Replacement.ClearFormatting
    'Get rid of quotes
    .Text = "(" & Chr(34) & ")([A-Z0-9][!^13]@)(" & Chr(34) & ")([ ^t:])"
    .Replacement.Text = "\2^t"
    .Execute Replace:=wdReplaceOne
    'Bold terms
    .Text = "([a-zA-Z0-9][!^13]@)([^t:])"
    .Replacement.Text = "\1^t"
    .Replacement.Font.Bold = True
    While .Execute
       If oRng.Characters(1).Start = oRng.Paragraphs(1).Range.Characters(1).Start Then
         oRng.Font.Bold = True
         oRng.Text = Replace(oRng.Text, ":", vbTab)
       End If
    Wend
  End With
lbl_Exit:
   Exit Sub
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote