#1
|
|||
|
|||
Macro to highlight unused definitions and undefined terms
Hello everyone,
I work on contracts and I’m looking for help in designing/drafting a macro. The contracts that I work on tend to contain a definitions section which attaches specific meanings to words. Those definitions can then be used in clauses throughout the contract. E.g.: Definition “Building” means the building at 1 New Street; Use The Building shall be accessible on a 24/7 basis. Drafting conventions There are a number of different conventions used to define definitions, but we can assume: - each word of a definition will be capitalised and the complete term will be enclosed in quote marks; and - each use of the defined term will be an exact match of the words in the definition and the capitalisation, but won’t be enclosed in quote marks. The problem When drafting long and complex documents you generally run into two problems: 1. You create definitions which are subsequently not used. E.g. “Blue Building” means the blue coloured building at 2 New Street; then this definition isn’t used elsewhere in the document. 2. You use words throughout the contract which should be definitions (i.e. they follow the same conventions as a definition) but are not actually defined. E.g. Continuing with the example above: “The Building and the Surrounding Zone shall be maintained to an adequate standard.” Building is defined (as above) but “Surrounding Zone”, whilst capitalised, doesn’t have a definition. The Requirement I want to: A. Create a macro which places in square brackets ([ ]) and highlights definitions which have been created and not used. B. Create a macro which generates a report of all capitalised words which don’t have a corresponding definition. I don’t have a coding background, but I’ve taught myself some VBA by hacking around and I have developed some useful tools. However, an efficient way to achieve the above has eluded me so far! For (A) I thought that it would be possible to use Word’s search function to loop through each instance of “[wildcard]” and test if a result occurs more than once. If it doesn’t, highlight it. However, I can’t seem to find a way to test if a result occurs more than once. This might also be defeated if a closing quotation mark is missing. For (B) I’m very lost on this one. It could: (i) extract a specified definitions section into a column in Excel; (ii) extract all capitalised words into a separate column (“Second Column”); (iii) deduplicate the Second Column; (iv) highlight all entries in the Second Column which do not have a matching entry in the other column. However, this strikes me as something that is likely to break on large documents. In addition, I’m not sure how to handle definitions which contain more than one word (but it could be assumed that any strings of capitalised words form part of the same definition). I know this way would result in false positives, but it should be fairly simple to manually remove those after the list is prepared. Any help or guidance this would be greatly appreciated. |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Macro that deletes unused styles | thejollyroger | Word VBA | 14 | 12-04-2017 09:00 AM |
Best Practice for Indexing Multiple Word Terms and Sub-Terms | jhy001 | Word | 4 | 11-06-2017 02:08 PM |
Macro Question: Need help making a macro to highlight the first word in every sentence | LadyAna | Word | 1 | 12-06-2014 10:39 PM |
Wild card to highlight capitalised terms? | bertietheblue | Word | 2 | 02-08-2013 04:44 PM |
find - reading highlight - highlight all / highlight doesn't stick when saved | bobk544 | Word | 3 | 04-15-2009 03:31 PM |