Alphabetizing index - apostrophe problem

  • Thread starter Thread starter Paul MR
  • Start date Start date
P

Paul MR

Word 2002 (10.4524.4219) SP-2
From my document I am trying to make an index of song titles. But when
I generate, the alphabetical order keeps getting screwed up by the
apostrophes like this:

I WANNA BE LOVED BY YOU, 30
IF YOU KNEW SUSIE, 34
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
IT HAD TO BE YOU, 36
IT'S ONLY A PAPER MOON, 33
I'VE GOT YOU UNDER MY SKIN, 32
I'VE GROWN ACCUSTOMED TO HER FACE, 32

How can I fix this?

Paul in San Francisco
 
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
 
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
 
The sort function when used to sort text does not ignore the apostrophe. It
treats it as an alphanumeric character and produces the list you originally
quoted. You can change all the apostrophes in your document to a single
smart quote (automatically if you like, using the autoformat as you type -
convert straight quotes to smart quotes) and the problem will go away. The
macro is only required if you want to retain a straight quote for the
apsotrophe. Using smart quotes for apostrophes produces the list that I
quoted.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
Interesting. I wouldn't have thought straight vs. smart would make this
difference. That explains why (*with* smart quotes) I'm sometimes not seeing
the sort results I expect.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA

Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
Graham: I am not using the sort function; I am using the index
function. PLEASE look again at my original post. Do you not agree that
if the straight apostrophe had indeed been indexed before A, then the
resulting list would have been in proper alphabetical order? At least
all the words beginning with "I' " should have been together in a group?
If we can agree on that, can we then agree that indexing a smart
apostrophe as a character after Z will result in an even more peculiar
list: "IT" would show up before "I'LL."
Paul
 
So, Suzanne, did you ever succeed in obtaining the indexing results you
expect even though you use smart quotes? How?
Paul in San Francisco
 
I was referring to sorting in tables and paragraphs, not indexes. Does your
index sort correctly if you use smart quotes in the XE fields?

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA

Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
YES! Using smart quotes in the XE fields did work. Thank you. I'm glad
this got fixed before I proceeded too far in the document.

I had turned off smart quotes intentionally, because my text has many
words that begin with an apostrophe ('twas, 'tis, 'cause, etc.) and the
smart quotes were displaying the apostrophe upside down -- i.e. as an
opening single quotation mark. Now I have smart quotes turned back on
for the remainder of the document.

Paul in San Francisco
 
Problem solved. Copying a smart quote to each XE field did the trick.
Thank you so much for pointing in the right direction.
Paul in San Francisco
 
You can force an apostrophe by pressing Ctrl+', ' (that is, press Ctrl and
the apostrophe key simultaneously, then press apostrophe again). This
technique can also be used to force opening or closing single or double
quotes as needed; see the shortcuts at
http://word.mvps.org/FAQs/General/InsertSpecChars.htm

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA

Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
Thanks again. As I make the transition from Word Perfect to Word, these
little tips and sources of information are very helpful.
Paul in San Francisco
 
In case no one else has pointed you to them (can't remember whether Charles
has already done so or not), these articles are helpful for those making the
transition from WordPerfect:

How Word differs from WordPerfect
http://word.mvps.org/FAQs/General/WordVsWordPerfect.htm

Some Tips and “Gotchas” for those who are new to Word
Especially if migrating from WordPerfect
http://word.mvps.org/FAQs/General/TipsAndGotchas.htm

Is There Life After “Reveal Codes”?
http://word.mvps.org/FAQs/General/RevealCodes.htm

WordPerfect to Word converters (and why none of them are perfect)
http://word.mvps.org/FAQs/General/WordPerfectConverters.htm

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA

Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
Back
Top