Sorry - didn't make myself clear enough. I created a directory that contains the file names that I want to save the separate documents as. Then I run the following macro. It is with this macro that I get the problem mentioned before.
Dim Source As Document, oblist As Document, DocName As Range, DocumentName As String
Set Source = ActiveDocument
With Dialogs(wdDialogFileOpen)
.Show
End With
Set oblist = ActiveDocument
Counter = 1
While Counter < oblist.Tables(1).Rows.Count
Set DocName = oblist.Tables(1).Cell(Counter, 1).Range
DocName.End = DocName.End - 1
DocumentName = "P:\hlock\winword\" & DocName.Text
Source.Sections.First.Range.Cut
Documents.Add
Selection.Paste
ActiveDocument.SaveAs FileName:=DocumentName, FileFormat:=wdFormatDocument, LockComments:=False, Password:="", AddToRecentFiles:=True, WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:=False
ActiveWindow.Close
Counter = Counter + 1
Wend
----- Doug Robbins - Word MVP wrote: -----
Not sure what macro you are referring to, but try:
Dim Letters As Integer, Counter As Integer, Source as Document, Target as
Document, Letter as Range
Set Source = ActiveDocument
Letters = Source.Sections.Count
For i = 1 to Letters
Set Letter = Source.Sections(i).Range
Letter.End=Letter.End-1
Set Target = Documents.Add
Target.Range=Letter
Target.SaveAs FileName:=â€Letter†& i, FileFormat:= _
wdFormatDocument, LockComments:=False, Password:="",
AddToRecentFiles:= _
True, WritePassword:="", ReadOnlyRecommended:=False,
EmbedTrueTypeFonts:= _
False, SaveNativePictureFormat:=False, SaveFormsData:=False, _
SaveAsAOCELetter:=False
Target.Close
Next i
--
Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.
Hope this helps
Doug Robbins - Word MVP
Hope said:
Your macro works great, however, I'm running into a couple of problems:
1. If the original merged document contains 4 letters and the
directory contains 4 records, the macro is only creating 3 new separate
documents.
2. Each new separate document has a section break-new page at the
end of the letter so that I end up with 2 pages instead of one.
Do you have any suggestions for solving this? I've gotten further than I
expected, so I would appreciate any input!