View Single Post
 
Old 09-19-2016, 03:20 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,370
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

You could do that with a series of wildcard Find operations, where:
Find = \([!\)]@^13
to find opening parentheses that lack closing ones;
Find = ^13[!\(]@\)
to find closing parentheses that lack opening ones;
Find = \[[!\]]@^13
to find opening square brackets that lack closing ones; and
Find = ^13[!\[]@\]
to find closing square brackets that lack opening ones.

Alternatively, you could use a macro like:
Code:
Sub Demo()
Dim oPara As Paragraph
For Each oPara In ActiveDocument.Paragraphs
  With oPara.Range
    If Len(Replace(.Text, "(", vbNullString)) <> Len(Replace(.Text, ")", vbNullString)) Then
      .Select
      MsgBox "Selected paragraph has unmatched smart parentheses", vbExclamation
      Exit Sub
    ElseIf Len(Replace(.Text, "[", vbNullString)) <> Len(Replace(.Text, "]", vbNullString)) Then
      .Select
      MsgBox "Selected paragraph has unmatched smart square brackets", vbExclamation
      Exit Sub
    End If
  End With
Next
End Sub
For PC macro installation & usage instructions, see: http://www.gmayor.com/installing_macro.htm
For Mac macro installation & usage instructions, see: http://word.mvps.org/Mac/InstallMacro.html
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote