Results 1 to 7 of 7
  1. #1
    2 Star Lounger
    Join Date
    Aug 2011
    Posts
    112
    Thanks
    35
    Thanked 3 Times in 3 Posts

    Extract all words with page numbers to new document

    I found a macro which extracts acronyms to a new document and it works good except for it ignores any acronyms within parentheses. I have no idea how to modify this macro or even if it can be.

    Does anybody know of a place to get such a macro?

  2. #2
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,054
    Thanks
    2
    Thanked 417 Times in 346 Posts
    The macro works fine in my testing. It finds and extracts all of:
    ABC {BCD} [CDE] <DEF> (EFG)
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  3. The Following User Says Thank You to macropod For This Useful Post:

    jrb (2012-11-07)

  4. #3
    2 Star Lounger
    Join Date
    Aug 2011
    Posts
    112
    Thanks
    35
    Thanked 3 Times in 3 Posts
    Hi Paul,

    Thank you for the sanity check. I don't know what I was doing, I thought for sure it was missing some acronyms, but after doubling checking I was just blind.

  5. #4
    2 Star Lounger
    Join Date
    Aug 2011
    Posts
    112
    Thanks
    35
    Thanked 3 Times in 3 Posts
    Hi Paul,

    I see in the macro where I can change the 3 to say a 2 to get all combinations 2 and greater, but is there a method to only capture acronyms from 2 to 5 in length?

    Code:
    .Text = "<[A-Z]{3" & strListSep & "}>"

  6. #5
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,054
    Thanks
    2
    Thanked 417 Times in 346 Posts
    Simply change:
    .Text = "<[A-Z]{3" & strListSep & "}>"
    to:
    .Text = "<[A-Z]{2" & strListSep & "5}>"
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  7. The Following User Says Thank You to macropod For This Useful Post:

    jrb (2012-11-07)

  8. #6
    2 Star Lounger
    Join Date
    Dec 2009
    Location
    Canada
    Posts
    122
    Thanks
    3
    Thanked 20 Times in 18 Posts
    The line of code sets up a wildcard pattern to look for a new word consisting of 3 or more uppercase characters characters. The strListSep variable uses your international list separator (typically a comma). To look for uppercase combinations of 2-5 characters, you'll want to have it use <[A-Z]{2,5}. To do this within your macro, use the following:
    Code:
    .Text = "<[A-Z]{2" & strListSep & "5}>"

    Edit: When I clicked submit, I could see that Paul had already responded as I was typing!
    Last edited by EricFletcher; 2012-11-07 at 19:46.

  9. The Following User Says Thank You to EricFletcher For This Useful Post:

    jrb (2012-11-07)

  10. #7
    2 Star Lounger
    Join Date
    Aug 2011
    Posts
    112
    Thanks
    35
    Thanked 3 Times in 3 Posts
    Perfect, thank you very much guys.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •