![]() |
|
|
|
#1
|
||||
|
||||
|
Here's a bit of code that will automate the process for you. It will select all, convert to list, sort by column 2 and then reconvert to text:
Open your VB window (Alt+F11) In the left hand window, look for 'Normal' and click on the + Click the + next to Microsoft Word Objects Double-click ThisDocument Paste the code below Import/Open your name list (make sure you only have names in your document) Run the Macro: (2003) Tools > Macro > Macros > (choose 'Sort_Name_List) > Run (2007) View > Macro > View Macros > (choose 'Sort_Name_List) > Run Code:
Sub Sort_Name_List()
'
' 06/05/2009 by Bird
'
ScreenUpdating = False
Selection.WholeStory
Selection.ConvertToTable Separator:=wdSeparateByDefaultListSeparator, _
NumColumns:=2, NumRows:=7, AutoFitBehavior:=wdAutoFitFixed
With Selection.Tables(1)
.Style = "Table Grid"
.ApplyStyleHeadingRows = True
.ApplyStyleLastRow = True
.ApplyStyleFirstColumn = True
.ApplyStyleLastColumn = True
End With
Selection.Sort ExcludeHeader:=False, FieldNumber:="Column 2", _
SortFieldType:=wdSortFieldAlphanumeric, SortOrder:=wdSortOrderAscending, _
FieldNumber2:="", SortFieldType2:=wdSortFieldAlphanumeric, SortOrder2:= _
wdSortOrderAscending, FieldNumber3:="", SortFieldType3:= _
wdSortFieldAlphanumeric, SortOrder3:=wdSortOrderAscending, Separator:= _
wdSortSeparateByCommas, SortColumn:=False, CaseSensitive:=False, _
LanguageID:=wdEnglishUK, SubFieldNumber:="Paragraphs", SubFieldNumber2:= _
"Paragraphs", SubFieldNumber3:="Paragraphs"
Selection.Rows.ConvertToText Separator:=wdSeparateByDefaultListSeparator, _
NestedTables:=True
ScreenUpdating = True
End Sub
|
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
how do i take my contact list to a new computer?
|
blade | Outlook | 2 | 01-13-2011 07:03 AM |
List option
|
shashijb | Excel | 1 | 12-18-2008 03:07 AM |
| Which app to use for list on Outlook? | sus | Misc | 0 | 08-26-2008 08:46 AM |
| creating a categories list | owwiii | Outlook | 0 | 08-09-2007 01:56 PM |
| Creating a Map From a List of Addresses | aleccamp | Excel | 0 | 11-19-2005 03:04 PM |