![]() |
#1
|
|||
|
|||
![]()
Hello,
I currently use a REGEX-based macro in MS Word to extract all uppercase words and generate a separate document listing these words in a table. This has been particularly helpful for creating acronym lists, such as those used in appendices. However, I would like to modify the existing macro to reduce "false positives"—specifically, words that are in uppercase but are not actual acronyms. To illustrate, I have attached two sample documents along with their respective outputs: 1. "Sample Document with Acronyms v01" Contents: This document contains 10 uppercase acronyms highlighted in green. There is also a mixed-case acronym ("IoT," standing for "Internet of Things") marked in yellow. The current macro does not recognize mixed-case acronyms. Process:
2. "Sample Document with Acronyms v02" Contents: This is a copy of v01 with added words ("TABLE OF CONTENTS," "PARA #1," "PARA #2") marked in red. These uppercase headers are not acronyms but are extracted by the macro. Process: Running the macro results in a new document listing the 10 green acronyms, but also includes the 4 additional uppercase header words (false positives). Issues with the Current Macro: Over-Inclusion: The macro extracts all uppercase words, including headers and other non-acronym text. Under-Inclusion: It does not extract acronyms that use mixed-case formatting, such as "IoT." Questions: Q1: How can the REGEX macro be adjusted to only include uppercase words within parentheses, potentially reducing false positives? Q2: Is there a way to modify the macro to extract mixed-case acronyms like "IoT," in addition to the standard uppercase acronyms? Even a solution that addresses only Q1 would be highly valuable, as the current macro generates an overwhelming number of false positives in lengthy documents. Thank you for considering my request, and I appreciate any guidance you can provide! |
#2
|
||||
|
||||
![]()
Since you haven't supplied your RegEx code, no-one is going to be able to help you with that. However, see: https://www.msofficeforums.com/word-...generator.html
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
![]()
Paul -- the existing REGEX code is included in the MS-Word document.
Again, please follow the provided instructions: Open the document. Select "View" from the Office ribbon. Navigate to "Macros" > "View Macros" and run "ExtractAcronymsToNewDocument." Also, see attached PNG. |
#4
|
||||
|
||||
![]()
All your zipped documents are in the docx format. Documents in the docx format cannot contain macros.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
|||
|
|||
![]()
I downloaded the zip file from the forum and all code was there.
|
#6
|
||||
|
||||
![]()
As I said:Undoubtedly, your documents are attached to a template that contains the macro, which makes the macro available to the documents - but only on your system.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
![]() |
Thread Tools | |
Display Modes | |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Please help where to modify the macro | John Brito | Word VBA | 2 | 12-22-2022 12:29 AM |
![]() |
tarikov2006 | Excel Programming | 1 | 11-18-2016 04:10 AM |
Macro help regex | subspace3 | Word VBA | 1 | 10-15-2014 09:53 AM |
![]() |
lsmcal1984 | Word | 3 | 09-04-2013 07:33 AM |
Outlook 2010 and modify font on existing e-mail | snowens | Outlook | 1 | 04-06-2011 01:57 PM |