Many thanks Graham for your persistence.
I was testing the new macro when you sent this reply, I think we came
to a very similar solution.
From your previous reply x2, indicates that the macro at the bottom
of the Individual Merge Letters instruction sheet maybe an old
version.
Below is the full macro that I am now using and it works perfectly,
hooray!
Sub SplitMergeLetter()
' splitter Macro modified to save individual letters with
' information from data source. The filename data must be added to
' the top of the merge letter - see web article.
Selection.EndKey Unit:=wdStory
Letters = Selection.Information(wdActiveEndSectionNumber)
Selection.HomeKey Unit:=wdStory
Counter = 1
While Counter < Letters
Application.ScreenUpdating = False
With Selection
.HomeKey Unit:=wdStory
.EndKey Unit:=wdLine, Extend:=wdExtend
.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
End With
sName = Selection
Docname = "D:\My Documents\Test\Merge\" & sName & ".doc"
ActiveDocument.Sections.First.Range.Cut
Documents.Add
With Selection
.Paste
.HomeKey Unit:=wdStory
.MoveDown Unit:=wdLine, Count:=1, Extend:=wdExtend
.Delete
[The above code is to remove the file name text at the top of the
document. New additional code added here, to delete any page break at
the end of the new document.]
.EndKey Unit:=wdStory
.MoveLeft Unit:=wdCharacter, Count:=1
.Delete Unit:=wdCharacter, Count:=1
[End of new code]
End With
ActiveDocument.SaveAs FileName:=Docname, _
FileFormat:=wdFormatDocument
ActiveWindow.Close
Counter = Counter + 1
Application.ScreenUpdating = True
Wend
End Sub
Many thanks again, and keep up the fantastic work you do here.
All the best
DeanH
Graham Mayor said:
Forget that - posted before testing properly
Try
With Selection
.Paste
.EndKey Unit:=wdStory
.TypeBackspace
.Delete Unit:=wdCharacter, Count:=1
End With
instead. This is a minor variation that works here - unfortunately I
don't have Word 2000 to check.
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>