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

On Wed, 4 Nov 2009 19:51:10 -0500, "Greg Maxey"
wrote:

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.


Nifty macro. I suggest adding "An " to the Case list however...

--
Bob
http://www.kanyak.com