Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 06-13-2019, 03:51 AM
maceslin maceslin is offline Acronym finder Windows 2K Acronym finder Office 2007
Novice
Acronym finder
 
Join Date: Jul 2012
Posts: 8
maceslin is on a distinguished road
Default Acronym finder

I review long documents with thousands of acronyms and need to create a list of all the acronyms. I found this code on another site but am unable to run it against a small Word doc I get "Compile error User-defined type not defined" Not sure what I need to change



Code:
 
Sub Acronyms()
    Dim dict, k, tmp
    Dim regExp, Match, Matches
    Dim rngRange As Range
    Set regEX = New regExp
    Set dict = CreateObject("scripting.dictionary")
    regEX.Pattern = "[A-Z]{2,}" '2 or more upper-case letters
    regEX.IgnoreCase = False
    regEX.Global = True
    Set Matches = regEX.Execute(ActiveDocument.Range.Text)
    For Each Match In Matches
        tmp = Match.Value
        If Not dict.Exists(tmp) Then dict.Add tmp, 0
        dict(tmp) = dict(tmp) + 1
    Next
    For Each k In dict.Keys
        Debug.Print k, dict(k)
    Next k
End Sub
Thanks in advance for your help, I am very new to VBA

Dave
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Acronym finder Acronym Finder Macro for Microsoft Word mars1886 Word VBA 15 03-30-2022 06:56 AM
Synonym Finder subrota Word VBA 3 04-29-2019 12:13 AM
Using a product key finder to transfer MS from PC to Mac - risky? loza890 Office 1 11-02-2014 10:43 PM
Acronym finder Acronym Finder Cray_Z Word VBA 14 09-22-2014 11:42 PM
Function Finder Kevin18014 Excel 3 01-02-2012 04:47 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:08 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft