none
how to check the opening and closing brackets in ms word? RRS feed

  • Question

  • Hi,

    I have pasted piece of very large code in ms word to do indentation, inserting comments and see if any mismatch of curly braces are not there. Please let me know whether there is any functionality provided by ms office in checking the pairs of brackets. If so, how to achieve this. Please note that I am working in a secured network so no utilies can be downloaded. I am using MS word 2003.

    If this is not the right forrum to post this, please correct me.

     

    Thanks

    Monday, September 5, 2011 1:14 PM

Answers

  • What is the purpose of the curly braces?  If they are intended to be part of field codes, they can only be inserted in pairs by the use of Ctrl+F9.

    If they serve some other unrelated purpose, you could use Find and Replace to replace { by { and then} by }, and note if the number of replacements is the same in each case.


    Doug Robbins - Word MVP dkr[atsymbol]mvps[dot]org
    • Proposed as answer by Liliane Teng Tuesday, September 13, 2011 3:24 AM
    • Marked as answer by Liliane Teng Friday, September 16, 2011 8:46 AM
    Monday, September 5, 2011 9:42 PM
  • Hi Anirudh,

    As Doug suggested, you could open the Replace dialog and replace the character you want to count with itself (replace { with { or } with }). Word's search and replace function could automatically report the number of replacements made.

    In other way, if you want to use macro to implement, you could check below sample. This macro counts the number of left parentheses in each paragraph of your document and makes sure you have the same number of right parentheses.

    http://wordribbon.tips.net/T001018_Checking_for_Matching_Parentheses.html
    (Checking for Matching Parentheses)

    If you have any concerns, please feel free to follow up.

    Have a nice day.

    Best regards


    Liliane Teng [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Liliane Teng Friday, September 16, 2011 8:46 AM
    Tuesday, September 13, 2011 3:23 AM

All replies

  • What is the purpose of the curly braces?  If they are intended to be part of field codes, they can only be inserted in pairs by the use of Ctrl+F9.

    If they serve some other unrelated purpose, you could use Find and Replace to replace { by { and then} by }, and note if the number of replacements is the same in each case.


    Doug Robbins - Word MVP dkr[atsymbol]mvps[dot]org
    • Proposed as answer by Liliane Teng Tuesday, September 13, 2011 3:24 AM
    • Marked as answer by Liliane Teng Friday, September 16, 2011 8:46 AM
    Monday, September 5, 2011 9:42 PM
  • Hi Anirudh,

    As Doug suggested, you could open the Replace dialog and replace the character you want to count with itself (replace { with { or } with }). Word's search and replace function could automatically report the number of replacements made.

    In other way, if you want to use macro to implement, you could check below sample. This macro counts the number of left parentheses in each paragraph of your document and makes sure you have the same number of right parentheses.

    http://wordribbon.tips.net/T001018_Checking_for_Matching_Parentheses.html
    (Checking for Matching Parentheses)

    If you have any concerns, please feel free to follow up.

    Have a nice day.

    Best regards


    Liliane Teng [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Liliane Teng Friday, September 16, 2011 8:46 AM
    Tuesday, September 13, 2011 3:23 AM