[mso] Re: Word Macro to create list of acronyms

  • From: "Green" <1z@xxxxxxxxxxxxxx>
  • To: <mso@xxxxxxxxxxxxx>
  • Date: Mon, 23 Aug 2004 20:13:24 +0200

Tony...

Out of interest I knocked this up and may actually use it myself! It
*should* pick out all sets of 2 capitals or more over the whole
document. I'm going to play with looking to see if it's in a heading
or not in a while.

I've made the actual write away routine seperate.. you could do what
you want there... write to a file and so on. My prefered option would
be to add a new document, create a table in it and write the acronyms
there along with a chr count and so on so that I could find them in
the doc easilly. OTOH you could do a global replace of the acronym
with something like a style and then make a TOC or whatever. Please
let us know how you get on.

HTH
Lisa

Option Explicit
Sub subCountAcronyms()

Dim olWholeStory As Range
Dim llChrCount As Long
Dim llChr As Long
Dim slChr As String * 1
Dim ilChr As Integer
Dim slAcronym As String

Set olWholeStory = Selection.Range
olWholeStory.WholeStory
llChrCount = olWholeStory.Characters.Count

llChr = 0
Do
  llChr = llChr + 1
  If llChr > llChrCount Then
    Exit Do
  End If

  ' Set up current chr.
  slChr = olWholeStory.Characters(llChr)
  ilChr = Asc(slChr)

  ' Is this letter upper case?
  Select Case ilChr
  Case Is < 65, Is > 90

    ' Not Upper case.

    ' Do we have an acronym to write?
    Select Case Len(slAcronym)
    Case Is > 1
      subWriteAcronym slAcronym
    End Select
    slAcronym = ""
  Case Else

    ' Upper Case.. Add it to string.
    slAcronym = slAcronym + slChr

  End Select

Loop
'
**********************************************************************
*
End Sub
Sub subWriteAcronym(spAcronym As String)
  MsgBox spAcronym
'
**********************************************************************
*
End Sub


*************************************************************
You are receiving this mail because you subscribed to mso@xxxxxxxxxxxxx or 
MicrosoftOffice@xxxxxxxxxxxxxxxx

To send mail to the group, simply address it to mso@xxxxxxxxxxxxx

To Unsubscribe from this group, send an email to 
mso-request@xxxxxxxxxxxxx with the word "unsubscribe" (without the quotes) in 
the subject line.

Or, visit the group's homepage and use the dropdown menu.  This will also allow 
you to change your email settings to digest or vacation (no mail).
//www.freelists.org/webpage/mso

To be able to use the files section for sharing files with the group, send a 
request to mso-moderators@xxxxxxxxxxxxx and you will be sent an invitation with 
instructions.  Once you are a member of the files group, you can go here to 
upload/download files:
http://www.smartgroups.com/vault/msofiles
*************************************************************

Other related posts: