Balancing Brackets

New Contributor

In the work which I do with MS Word, I need to type quite complex sentences with lots of bracketed text in them - sometimes 'nested'.  For example:

  • Some text 1 (some text 2 [some text 3] some text 4) some text 5 (some text 6).

and I want to find an easy way the ensure that the brackets (or parentheses or square brackets) remain balanced (a 'close bracket' to match each 'opening bracket').  To help me with this I have made entries into the autocorrect table such that if I type an opening bracket "(" it is replaced with an opening bracket followed by a closing bracket "()" and then try to remember to hit the 'left arrow' key afterwards.  Once I have completed a document I then just 'find' the latter (e.g., "()") and this at least shows me where I forgot to hit the 'left arrow' key and I can then make the necessary adjustments manually before saving the document.

 

It would be really good though if I could include the 'left arrow' key into the autocorrect text - does anybody know how to achieve that?

 

Failing that, if the Microsoft developers ever read this entry, may I suggest an enhancement whereby an extra checkbox is placed in the autocorrect dialog saying something like "Include balanced brackets?" (a bit like the 'smart quotes' checkbox) and it does the necessary automatically - thanks

3 Replies

@LimehouseJohnYou could assign a macro containing the following code to the keyboard shortcut e.g. ALT+9

 

With Selection
    .InsertBefore "("
    .InsertAfter ")"
    .Collapse wdCollapseStart
    .MoveRight wdCharacter, 1
End With

 

and, for [ ], have another one containing the following code assigned to ALT+SHIFT+9

 

With Selection
    .InsertBefore "["
    .InsertAfter "]"
    .Collapse wdCollapseStart
    .MoveRight wdCharacter, 1
End With

 

You could use a similar macro with { } for a pair of curly braces, assigned to, say ALT+CTRL+9

 

To make suggestions for changes to Word, use the Feedback facility accessible by clicking on the Help tab of the ribbon.

@Doug_Robbins_Word_MVPThat's perfect and works well - thank you very much.

 

I don't suppose that you know how I could get the identical keyboard shortcuts into Outlook (365) for when I'm writing an email perchance - I should be really grateful if you did.

 

Thanks very much - even if you don't.

 

Best regards

 

LimehouseJohn

It's no where near as straight forward in Outlook and I would think that if the message is that complex, it might be better to compose it in Word and then copy and paste into Outlook.