Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
CMDS
 
Posts: n/a
Default sorting by last name

I have 150 pages in Word that I would like to sort based on client LAST NAME,
FIRST NAME. Each page contains the client name and page of text specifcally
about the client which will need to be kept with the name during the alpha
sort. How would I put in a field for LAST NAME, FIRST NAME and have WORD put
each page in order based on alpha order of the client name? The page of text
notes needs to be intact during this sort. I am not sure how to capture the
text on each page so that it includes the client's name where I can later
sort or how to enter a field for client LAST NAME so the I can perform the
sort in Ascending order. Any ideas? Please reply to:

Thank you,

DReece
  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP
 
Posts: n/a
Default sorting by last name

Exactly where on the page is the name?

I think that what you will need to do is save each page of the document as a
separate file in a directory that you create for the purpose with the name
of the file being the LastNameFirstName and then use a macro to recombine
the individual files into a new document by order of the filename. A
modification of the following macro could do the splitting:

Sub splitter()

'

' splitter Macro

' Macro created 16-08-98 by Doug Robbins to save each page of a document

' as a separate file with the name Page#.DOC

'

Dim Counter As Long, Source As Document, Target As Document

Set Source = ActiveDocument

Selection.HomeKey Unit:=wdStory

Pages = Source.BuiltInDocumentProperties(wdPropertyPages)

Counter = 0

While Counter Pages

Counter = Counter + 1

DocName = "Page" & Format(Counter)

Source.Bookmarks("\Page").Range.Cut

Set Target = Documents.Add

Target.Range.Paste

Target.SaveAs FileName:=DocName

Target.Close

Wend

End Sub

Then, the following macro should recombine the documents:

Dim MyPath As String
Dim MyName As String
Dim Source As Document
Dim Target As Document

'let user select a path
With Dialogs(wdDialogCopyFile)
If .Display() -1 Then Exit Sub
MyPath = .Directory
End With

'strip quotation marks from path

If Len(MyPath) = 0 Then Exit Sub

If Asc(MyPath) = 34 Then
MyPath = Mid$(MyPath, 2, Len(MyPath) - 2)
End If

'get files from the selected path
'and insert them into the doc
MyName = Dir$(MyPath & "*.*")
Set Target = Documents.Add
Do While MyName ""
Set Source = Documents.Open(MyName)
Target.Range.InsertAfter Source.Range.FormattedText
Source.Close wdDoNotSaveChanges
MyName = Dir
Loop

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"CMDS" wrote in message
...
I have 150 pages in Word that I would like to sort based on client LAST
NAME,
FIRST NAME. Each page contains the client name and page of text
specifcally
about the client which will need to be kept with the name during the alpha
sort. How would I put in a field for LAST NAME, FIRST NAME and have WORD
put
each page in order based on alpha order of the client name? The page of
text
notes needs to be intact during this sort. I am not sure how to capture
the
text on each page so that it includes the client's name where I can later
sort or how to enter a field for client LAST NAME so the I can perform the
sort in Ascending order. Any ideas? Please reply to:

Thank you,

DReece



Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Need option to ignore quotation marks in sorting bibliography. Syntactician Microsoft Word Help 1 July 6th 05 11:17 PM
Sorting dates peturpin Tables 5 June 21st 05 08:10 PM
Sorting by Dates Chris Wagner Microsoft Word Help 1 May 13th 05 01:00 AM
sorting alphanumerically in a table Fred Microsoft Word Help 2 February 5th 05 05:47 PM
Sorting a table while keeping some related rows together Dan Corban Tables 7 January 20th 05 07:31 PM


All times are GMT +1. The time now is 01:55 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"