View Single Post
  #4   Report Post  
Posted to microsoft.public.word.docmanagement
Greg Maxey[_2_] Greg Maxey[_2_] is offline
external usenet poster
 
Posts: 668
Default Sort without "the" or "a"

Ms. Barnhill,

Second option very neat. Learn something new everyday. You can also do
that with nails and hammers ;-)

Sub ScratchMacoII()
Dim oRng As Word.Range
Dim oPar As Paragraph
Dim oRngProcess
Dim pStr As String
Set oRng = Selection.Range
For Each oPar In oRng.Paragraphs
Select Case oPar.Range.Words.First
Case "The ", "A "
oPar.Range.Words.First.Font.Hidden = True
oPar.Range.Shading.BackgroundPatternColorIndex = wdBrightGreen
End Select
Next
Selection.Sort
For Each oPar In oRng.Paragraphs
Select Case oPar.Range.Shading.BackgroundPatternColorIndex
Case wdBrightGreen
oPar.Range.Words.First.Font.Hidden = False
oPar.Range.Shading.BackgroundPatternColorIndex = wdAuto
End Select
Next
End Sub

***Assumes of course that no paragraphs shading is used in the original
text.


Suzanne S. Barnhill wrote:
Word doesn't provide a way to do this unless you either put "The"
after the title ("ABC, The") or temporarily format "The" and A" as
Hidden Text, hide them, sort, and then remove the Hidden property.


"lilac" wrote in message
...
I want to sort a list of titles, but items such as "The ABC" should
be under
A not T. How do I do this?


--
Greg Maxey

See my web site http://gregmaxey.mvps.org
for an eclectic collection of Word Tips.

Arrogance is a weed that grows mostly on a dunghill (Arabic proverb)