Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 09-19-2016, 03:20 PM
macropod's Avatar
macropod macropod is offline How to search for unclosed brackets Windows 7 64bit How to search for unclosed brackets Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,516
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
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Outlook leaves 2-3 unclosed tasks Jennifer Murphy Outlook 0 08-24-2014 07:08 PM
Gray square brackets waldux Word 8 09-25-2013 04:14 PM
Finding contents of brackets return2300 Word VBA 0 09-04-2013 11:04 AM
brackets citation uncung Word 1 07-13-2011 01:39 PM
Brackets Issue... DarkJudge1 Outlook 0 07-06-2010 05:15 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:41 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft