Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
How do I build an Index but use every word in the document?
I want to build an index, but I have a large file currently over 100 pages
and growing. Instead of building and index and going through and selecting each word to index, I would like to just build an index of all the words in the document with their page numbers. I saw a section in help where you can build a file with a table but you still have to add the words in to it. I know this will get messy with a lot of 'the' 'of' and 'is' but can anyone help me with this? |
#2
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
How do I build an Index but use every word in the document?
The method is to create a list of all the words in the document, save that
into a separate file, then use that to create a concordance index. You can create a unique word list by copying the document, removing all punctuation, replacing all spaces with paragraphs, then copying into Excel and doing a unique sort. Be aware that for most purposes, this is a seriously lousy way to create an index. The index should contain words, phrases, and synonyms thereof (that might not actually occur in the text), that *you* judge will be of use to your readers. Most of the words in your document, even after you remove the articles and prepositions, are not useful in an index (Just consider your own post: would you want to index it on 'want', 'build', 'large', 'currently', etc?). Creating a good index is a creative, intellectual act, not a bit of mindless word-processing. "WesT" wrote in message ... I want to build an index, but I have a large file currently over 100 pages and growing. Instead of building and index and going through and selecting each word to index, I would like to just build an index of all the words in the document with their page numbers. I saw a section in help where you can build a file with a table but you still have to add the words in to it. I know this will get messy with a lot of 'the' 'of' and 'is' but can anyone help me with this? |
#3
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
How do I build an Index but use every word in the document?
Here's a macro that will do part of what you want but I don't know how to add
the page numbers. Text of document from PC Magazine CreateListOfWords macro PCUser Magazine To run this macro: 1 First put this code into your Normal.dot file (instructions below). 2 Open a file you want to create a word list from. Run the macro createListOfWords on the file (Tools, Macro, Macros, createListOfWords and click Run). You will end up with a list of words only, one per line. You know the macro is finished when you see a message box on the screen. Wait! It will take some time to run, depending on the file size and the speed of your computer. 3 Save this file as a plain text file (File, Save As, from the Save as type list choose Plain Text (*.txt) and give it a name. 4 Open Excel. Open the saved text file (you may have to choose .txt from the Excel Files of type list in the Open dialog to see the file). 5 Press Finish when the Import Text dialog appears €“ theres nothing you need do. 6 Run the Excel macro calculateFrequency to calculate the frequencies of the words in the file. Problems? If you get a message saying "The macros in the project are disabled. Please refer to the online help or documentation of the host application determine how to enable macros", change the macro security level by choosing Tools, Macro, Security, Security Level tab. Select the Medium option and click OK. Exit and restart Word for the change to take place. Now, when you open this file, or any other file which and contains macros, you'll be prompted to enable or disable the macros -- to run a macro in a file you must choose Enable Macros. Macro code This is the text of the macro: Sub CreateListOfWords() 'strip out the word "the" and all punctuation. Place one word per line Set myRange = ActiveDocument.Content myRange.Find.Execute FindText:=" the ", ReplaceWith:=" ", Replace:=wdReplaceAll myRange.Find.Execute FindText:="^p", ReplaceWith:=" ", Replace:=wdReplaceAll myRange.Find.Execute FindText:=" ", ReplaceWith:=" ", Replace:=wdReplaceAll myRange.Find.Execute FindText:=" ", ReplaceWith:="^p", Replace:=wdReplaceAll myRange.Find.Execute FindText:="^p^p", ReplaceWith:="^p", Replace:=wdReplaceAll myRange.Find.Execute FindText:=",", ReplaceWith:="", Replace:=wdReplaceAll myRange.Find.Execute FindText:=".", ReplaceWith:="", Replace:=wdReplaceAll myRange.Find.Execute FindText:="!", ReplaceWith:="", Replace:=wdReplaceAll myRange.Find.Execute FindText:=";", ReplaceWith:="", Replace:=wdReplaceAll myRange.Find.Execute FindText:=":", ReplaceWith:="", Replace:=wdReplaceAll myRange.Find.Execute FindText:="(", ReplaceWith:="", Replace:=wdReplaceAll myRange.Find.Execute FindText:=")", ReplaceWith:="", Replace:=wdReplaceAll myRange.Find.Execute FindText:="~", ReplaceWith:="", Replace:=wdReplaceAll myRange.Find.Execute FindText:="1", ReplaceWith:="", Replace:=wdReplaceAll myRange.Find.Execute FindText:="2", ReplaceWith:="", Replace:=wdReplaceAll myRange.Find.Execute FindText:="3", ReplaceWith:="", Replace:=wdReplaceAll myRange.Find.Execute FindText:="4", ReplaceWith:="", Replace:=wdReplaceAll myRange.Find.Execute FindText:="5", ReplaceWith:="", Replace:=wdReplaceAll myRange.Find.Execute FindText:="6", ReplaceWith:="", Replace:=wdReplaceAll myRange.Find.Execute FindText:="7", ReplaceWith:="", Replace:=wdReplaceAll myRange.Find.Execute FindText:="8", ReplaceWith:="", Replace:=wdReplaceAll myRange.Find.Execute FindText:="9", ReplaceWith:="", Replace:=wdReplaceAll myRange.Find.Execute FindText:="^t", ReplaceWith:="", Replace:=wdReplaceAll 'remove all 2 and 1 letter words fcount = ActiveDocument.Paragraphs.Count For i = fcount - 1 To 1 Step -1 If Len(ActiveDocument.Paragraphs(i).Range) 4 Then ActiveDocument.Paragraphs(i).Range.Delete ElseIf ActiveDocument.Paragraphs(i).Range = "the" Then ActiveDocument.Paragraphs(i).Range.Delete End If Next i MsgBox "Save the file as a text file and then open it in Excel and run the frequency macro." End Sub You can add more lines to the first part of the macro to strip out other characters as required. Right now it strips out numbers and basic punctuation but you may find you use other characters in your text so feel free to add lines to strip them out too. Add the macro to Normal.dot To add this macro to your own Normal.dot file so it is always available when you start Word, with the file createlistofwords.doc open on the screen, choose Tools, Macro, Macros, Organizer, Macro Project Items tab. You should see a dialog with createlistofwords.doc on the left and Normal.dot on the right. Select the createlistofwords.doc option in the box on the left and click Copy to move it to the box on the right. Click Close to finish. Add it to a toolbar button To add a toolbar button to run this macro, right click any toolbar and choose Customize, Commands tab. Scroll down to locate the Macros entry in the Categories list and from the Commands list drag the Normal. createlistofwords.doc. createlistofwords.doc entry up and onto the toolbar. Right click the new button and in the Name area give it a shorter name and click Close in the Customize dialog. "WesT" wrote: I want to build an index, but I have a large file currently over 100 pages and growing. Instead of building and index and going through and selecting each word to index, I would like to just build an index of all the words in the document with their page numbers. I saw a section in help where you can build a file with a table but you still have to add the words in to it. I know this will get messy with a lot of 'the' 'of' and 'is' but can anyone help me with this? |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
I'm looking for a pc server build document template in Word | Microsoft Word Help | |||
how can I automatically build an acronym list in a word document? | Microsoft Word Help | |||
How to I build navigation into word document to link them | Page Layout | |||
How do build a TOC for a long document? 11 Chapters | New Users | |||
how to build a document for knowledge base, any suggestions | Page Layout |