Shellley, Vivka
While not a perfect check, you could add a simple function to help check for paired quotes:
Code:
Sub PlainDefinition_FormatBold()
'Select one or more definitions with plain text and plain quotes and format bold
Dim rng As Range
Application.ScreenUpdating = False
If Selection.Type = wdSelectionIP Then
MsgBox "You have not selected any text.", vbInformation + vbOKOnly, "Invalid selection"
Exit Sub
Else
Set rng = Selection.Range
If fcnPaired(rng.Text) Then
With rng.Find
.ClearFormatting
.Replacement.ClearFormatting
.Forward = False
.Wrap = wdFindStop
.Format = True
.MatchWildcards = True
.Text = "[""""]*[""""]" 'Find any text within quotes
.Replacement.Font.Bold = True 'Replacement text is bold
.Execute Replace:=wdReplaceAll
.Text = "\([""""]*[""""]\)" 'Find any text within quotes within brackets
.Replacement.Font.Bold = True
.Execute Replace:=wdReplaceAll
End With
Application.ScreenUpdating = True
Else
MsgBox "Quotes in the selected text are not properly paired." & vbCr + vbCr _
& "Select text containing only properly enclosed quoted text and try again.", vbInformation + vbOKOnly, "OPEN QUOTE"
End If
Set rng = Nothing
End If
lbl_Exit:
Exit Sub
End Sub
Function fcnPaired(strCheck As String) As Boolean
Dim arrCheck() As String
fcnPaired = False
arrCheck = Split(strCheck, Chr(34))
If UBound(arrCheck) Mod 2 = 0 Then
fcnPaired = True
End If
lbl_Exit:
Exit Function
End Function