Ultra Smart Parens Plus All Caps Acronym and Meaning Extraction

ChrisOK

Well-known Member
Joined
Mar 26, 2003
Messages
601
Need to find all instances of parentheses within a Word doc that have 2 or more characters within the parens.
"but wait - there's more!"
Need to make sure it doesn't pick up a sentence within parens, I'm hoping there's a way to enforce that at least 2 of the characters are in ALL CAPS consecutively)
If we say: just make sure there are at least 2 All Caps it could still pick up something like: (Computer Equipment) (not good)

Ultimately, I'm trying to extract all Acronyms (AND THEIR MEANINGS) from a Word doc.
I've found many posts that extract full all caps words - but don't want that...
Need the parens finder in place to narrow it down to hopefully just the acronyms and not other words in all caps and not other words in parens like "Computer Equipment".

The documents I'm working with are very strict in having the meaning of the acronym placed PRIOR to the acronym so my thought is -- if we can extract the full sentence preceding the parens that holds at least 2 consecutive all caps -- then, we'll be able to capture the meanings!
(Yes, probably a bit of other garb too) -- but I'm probably living a pipe dream if I think the VBA code can evaluate the acronym and then pull the "x" number of words preceding it that correspond... Hopefully, someone can tell me it's not a pipe dream at'all!?

Example:
*Course of Action (COA) - would pick up 3 preceding words since the acronym has 3 chars
*Total Case Incidence Rate (TCIR) - would pick up 4 preceding words since the acronym has 4 chars
*Accountable Property System of Record (APSR) - this is where it gets tricky (see the next one too)
*Service Development and Delivery Process (SDDP) - would pick up 5 preceding words because it sensed that it needed 5 words that started with a capital letter...so when it encountered the word "and" - it kept going left until it knew it had extracted 5 words that started with a capital letter (and) how ever many in between words as necessary..

Keep in mind, sometimes the acronyms might contain a NON-ALL CAP letter or a special character)
*Packaging, Transportation, and Regulated Material (PT&RM)
*Department of Defense (DoD)

If it's smart enough to accomplish that -- then I'll be doin' a major happy dance...
How ever close we can get -- would be greatly appreciated...
If it's just picking up a full sentence where ALL CAPS within PARENS exist together -- that's great...

Oh! The results can be placed into another new empty Word doc - or into an Excel file, whatever is easiest..
The code can assume the active Word doc is open when "Run" is clicked..
 
PETER, thanks again for the effort -- and totally understand the novice disclaimer =-) I pasted the latest code into a module of the word document - hit run - and it indeed went to the end of the document on a nice new page and placed a header row: "Acronymn" "Meaning" -- however, no results were within the table it created.

To answer your question about repeats --
Yes, it's a large contract and throughout it -- terms are repeated --but that wasn't a problem, I simply pasted the results into an excel file, eliminated the duplicates, CTRL G to look up issues that didn't feed the full term in -- manually backfilled those -- and all was good using the other code Paul provided.
It look a little manual effort but yet still saved an ENORMOUS amount of time --- So -- unless you are driven to keep dabbling with it -- I would not worry about it -- I've got something that gets the extraction done and I hate to waste any of your time...
If you do post something new, I'll certainly check it out and see if it works better -- but I think I'm good for now -- thanks so much!!
Thanks for trying it and the feedback. I had a bit of fum trying, but it sounds like Paul has done well for you (not surprising from a Word MS MVP ;)) so I'll leave it for now. :)
 
Upvote 0

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off

Forum statistics

Threads
1,223,796
Messages
6,174,655
Members
452,575
Latest member
Fstick546

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top