Microsoft Word - How can I automatically create a list of capitalized words and phrases?

K

Kavi

I have a really long document and I need to find a way to
automatically pull a list of capitalized words and phrases (e.g.,
Idaho, Supreme Court, etc.) into a list of such words and phrases.

Does anyone know how I can do that? Is there a tool or something?

Thanks!
 
G

Greg Maxey

Kavi,

Maybe someone will come along with a solution, but that is a pretty tall
order. Consider your example:

I think that you will agree that Supreme Court is not a word. It is two
words. A list using the text in your post would return

I
I
Idaho
Supreme
Court
Does
I
Is
Thanks

You can confirm that by pasting your message in a new Word document and
running the macro shown below:

Sub Scratchmacro()
Dim myArray() As String
Dim oWord As Range
Dim i As Long
Dim lngCount As Long
lngCount = ActiveDocument.Words.Count
ReDim myArray(lngCount)
For Each oWord In ActiveDocument.Words
If oWord.Characters.First Like "[A-Z]" Then
myArray(i) = oWord
i = i + 1
End If
Next
ReDim Preserve myArray(i)
i = 0
For i = 0 To UBound(myArray)
MsgBox myArray(i)
Next i
End Sub
 
H

Helmut Weber

Hi Submariner,
I think that you will agree that Supreme Court is not a word.
It is two words.

it isn't that far from Word programming to linguistics.

What I was taught is, that if no other word fits between
two words, who may be found on their own as well,
such as "killer whale", this is to be regarded as one word.

Same with "singer songwriter",
though there is "singer composer songwriter",
which is then regarded as consisting of
"singer composer" and "songwriter".

Or "killer hunter" and "killer whale hunter".

All in all, just another helpless attempt to
find rules for natural language,
which simply doesn't obey to rules.

As soon as there seems to be a rule,
someone breaks it in order to get more attention,
as long as there is sufficient redundancy for being understood.

Have a nice day.

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top