Hi Greg, thank you so much for the updated code. I've run it on a larger set of definitions to be converted and a few things happened. I've added 0-9 to the code to deal with legislation definitions that start with a number. It has also boldened some text it shouldn't and has removed the colon from these also.
'this Lease' hasn't picked up the word 'this' which I suspect is because the code is only looking for initial caps.
Non-Structure Alteration at sub level (b) its changed the line to bold and has removed the colon and inserted a tab - same for Property and Regulations - is this because there are initial cap words within the sentence?
TEST RUN.docx
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 = wdFindContinue
.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:=wdReplaceAll
'Bold terms
.text = "([A-Z0-9][!^13]@)([^t:])"
.Replacement.text = "\1^t"
.Replacement.Font.Bold = True
.Execute Replace:=wdReplaceAll
End With
lbl_Exit:
Exit Sub
End Sub