View Single Post
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Greg Maxey Greg Maxey is offline
external usenet poster
 
Posts: 285
Default Microsoft Word - How can I automatically create a list of capitalized words and phrases?

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

--
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.


Kavi wrote:
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!