View Single Post
  #3   Report Post  
Posted to microsoft.public.word.newusers
Paul MR
 
Posts: n/a
Default Alphabetizing index - apostrophe problem

Thanks, Graham. But I'm not sure I understand your analysis.

First, it seems as though the index function alphabetized by completely
ignoring the '. It clearly did not sort the ' before a.

Secondly, if I understand your suggestion, I am first supposed to
generate an index which will be sorted incorrectly. Then I am to block
select the incorrect index (which will run to several pages) and then I
am to apply the find and replace macro you kindly provided. I will have
to go through this process after each draft of the document that might
add anything to the index or change the page number where the index
target is located. Is my understanding correct?
Paul in San Francisco

Graham Mayor wrote:
If you sort text alpha-numerically then ' comes before a, so you will get
the sort order you showed. If you use the replace funtion to replace ' with
^0146, ^0146 (smart quote) comes after Z so you can sort to produce


I WANNA BE LOVED BY YOU, 30

I'LL GET BY, 31

I'LL NEVER FALL IN LOVE AGAIN, 31

I'LL NEVER SMILE AGAIN, 31

I'M BEGINNING TO SEE THE LIGHT, 31

I'VE GOT YOU UNDER MY SKIN, 32

I'VE GROWN ACCUSTOMED TO HER FACE, 32

IF YOU KNEW SUSIE, 34

IT HAD TO BE YOU, 36

IT'S ONLY A PAPER MOON, 33


If you want you can then replace ^0146 with '

The following macro will do all that to a selected block of titles.
http://www.gmayor.com/installing_macro.htm

Sub SongSort()
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "'"
.Replacement.Text = "^0146"
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute replace:=wdReplaceAll
Selection.Sort , FieldNumber:="Paragraphs", _
SortFieldType:=wdSortFieldAlphanumeric, _
SortOrder:=wdSortOrderAscending
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "^0146"
.Replacement.Text = "'"
End With
Selection.Find.Execute replace:=wdReplaceAll
End Sub