Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Mail Merge create individual documents
Word 2000SP3 on Windows 2000 SP4
I have set up a mail merge from an Excel source, this is not a problem. But is it possible for the merge to automatically create individual documents from the data set for each record? Also is it possible for the new individual documents to be renamed with say the Name field? Many thanks in advance. DeanH |
#2
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Mail Merge - create individual documents
See http://www.gmayor.com/individual_merge_letters.htm
Peter Jamieson "DeanH" wrote in message ... Word 2000SP3 on Windows 2000 SP4 I have set up a mail merge from an Excel source, this is not a problem. But is it possible for the merge to automatically create individual documents from the data set for each record? Also is it possible for the new individual documents to be renamed with say the "Name" field? Many thanks in advance. DeanH |
#3
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Mail Merge - create individual documents
See the "Individual Merge Letters" item on fellow MVP Graham Mayor's website
at: http://www.gmayor.com/individual_merge_letters.htm If you were using Word XP or later, the "Add-in to Merge Letters to Separate Files" that I have written and that can be downloaded from that site would allow you to create each letter as a separate file with a filename taken from a field in the data source with a minimum of fuss. -- 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 "DeanH" wrote in message ... Word 2000SP3 on Windows 2000 SP4 I have set up a mail merge from an Excel source, this is not a problem. But is it possible for the merge to automatically create individual documents from the data set for each record? Also is it possible for the new individual documents to be renamed with say the "Name" field? Many thanks in advance. DeanH |
#4
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Mail Merge - create individual documents
Many thanks Peter and Doug.
I shall give these instructions a go, so cross-fingers for me. Thanks again. DeanH "Doug Robbins - Word MVP" wrote: See the "Individual Merge Letters" item on fellow MVP Graham Mayor's website at: http://www.gmayor.com/individual_merge_letters.htm If you were using Word XP or later, the "Add-in to Merge Letters to Separate Files" that I have written and that can be downloaded from that site would allow you to create each letter as a separate file with a filename taken from a field in the data source with a minimum of fuss. -- 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 "DeanH" wrote in message ... Word 2000SP3 on Windows 2000 SP4 I have set up a mail merge from an Excel source, this is not a problem. But is it possible for the merge to automatically create individual documents from the data set for each record? Also is it possible for the new individual documents to be renamed with say the "Name" field? Many thanks in advance. DeanH |
#5
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Mail Merge - create individual documents
Hi Doug.
The last macro (SplitMergeLetter, as I am Word2000) works wonderfully. Just one comment, what script can I add to this macro to tidy up the individual documents because they are saved with a Section Break (NextPage), and one paragraph mark for the new blank page, at the end of each file. This would just finish a wonderful job. Many thanks again. "DeanH" wrote: Many thanks Peter and Doug. I shall give these instructions a go, so cross-fingers for me. Thanks again. DeanH "Doug Robbins - Word MVP" wrote: See the "Individual Merge Letters" item on fellow MVP Graham Mayor's website at: http://www.gmayor.com/individual_merge_letters.htm If you were using Word XP or later, the "Add-in to Merge Letters to Separate Files" that I have written and that can be downloaded from that site would allow you to create each letter as a separate file with a filename taken from a field in the data source with a minimum of fuss. -- 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 "DeanH" wrote in message ... Word 2000SP3 on Windows 2000 SP4 I have set up a mail merge from an Excel source, this is not a problem. But is it possible for the merge to automatically create individual documents from the data set for each record? Also is it possible for the new individual documents to be renamed with say the "Name" field? Many thanks in advance. DeanH |
#6
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Mail Merge - create individual documents
The macro does not *add* a section break to the document, but splits on the
section break and should not do what you report. If you merge just one record does that merged document have an unwanted page? My guess is that your merge document is just a tad too long to fit on the page without forcing the final paragraph mark to a new page. Try deleting that last paragraph mark (or reformatting it as 1 point size) so that it all stays on the same page. -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org DeanH wrote: Hi Doug. The last macro (SplitMergeLetter, as I am Word2000) works wonderfully. Just one comment, what script can I add to this macro to tidy up the individual documents because they are saved with a Section Break (NextPage), and one paragraph mark for the new blank page, at the end of each file. This would just finish a wonderful job. Many thanks again. "DeanH" wrote: Many thanks Peter and Doug. I shall give these instructions a go, so cross-fingers for me. Thanks again. DeanH "Doug Robbins - Word MVP" wrote: See the "Individual Merge Letters" item on fellow MVP Graham Mayor's website at: http://www.gmayor.com/individual_merge_letters.htm If you were using Word XP or later, the "Add-in to Merge Letters to Separate Files" that I have written and that can be downloaded from that site would allow you to create each letter as a separate file with a filename taken from a field in the data source with a minimum of fuss. -- 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 "DeanH" wrote in message ... Word 2000SP3 on Windows 2000 SP4 I have set up a mail merge from an Excel source, this is not a problem. But is it possible for the merge to automatically create individual documents from the data set for each record? Also is it possible for the new individual documents to be renamed with say the "Name" field? Many thanks in advance. DeanH |
#7
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Mail Merge - create individual documents
Thanks for the quick response.
My template is not too long, once merged the bottom line is over an inch away from the footer. Due to the information I am merging (numbers and names) the merged document never gets close to the footer. I have merged just one page, this ends with a Section Break(Continuous), all on one page. Run the macro, now ends with Section Break (Next Page) and a blank new page (obviously). Section Break (Continuous) has disappeared. I understand that the macro doesnot add the section break, but can I slot in to the macro some script to delete the Next Page before the individual file is saved? Many thanks DeanH "Graham Mayor" wrote: The macro does not *add* a section break to the document, but splits on the section break and should not do what you report. If you merge just one record does that merged document have an unwanted page? My guess is that your merge document is just a tad too long to fit on the page without forcing the final paragraph mark to a new page. Try deleting that last paragraph mark (or reformatting it as 1 point size) so that it all stays on the same page. -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org DeanH wrote: Hi Doug. The last macro (SplitMergeLetter, as I am Word2000) works wonderfully. Just one comment, what script can I add to this macro to tidy up the individual documents because they are saved with a Section Break (NextPage), and one paragraph mark for the new blank page, at the end of each file. This would just finish a wonderful job. Many thanks again. "DeanH" wrote: Many thanks Peter and Doug. I shall give these instructions a go, so cross-fingers for me. Thanks again. DeanH "Doug Robbins - Word MVP" wrote: See the "Individual Merge Letters" item on fellow MVP Graham Mayor's website at: http://www.gmayor.com/individual_merge_letters.htm If you were using Word XP or later, the "Add-in to Merge Letters to Separate Files" that I have written and that can be downloaded from that site would allow you to create each letter as a separate file with a filename taken from a field in the data source with a minimum of fuss. -- 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 "DeanH" wrote in message ... Word 2000SP3 on Windows 2000 SP4 I have set up a mail merge from an Excel source, this is not a problem. But is it possible for the merge to automatically create individual documents from the data set for each record? Also is it possible for the new individual documents to be renamed with say the "Name" field? Many thanks in advance. DeanH |
#8
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Mail Merge - create individual documents
The following macro contains the core code
Sub SplitCheck() Selection.EndKey Unit:=wdStory Letters = Selection.Information(wdActiveEndSectionNumber) Selection.HomeKey Unit:=wdStory ActiveDocument.Sections.First.Range.Cut Documents.Add With Selection .Paste ' .EndKey Unit:=wdStory ' .MoveLeft Unit:=wdCharacter, Count:=1 ' .Delete Unit:=wdCharacter, Count:=1 End With End Sub The remmed out lines are the lines that are supposed to remove the errant section break. Run this macro on a merged document and see what you end up with. You should have one document with a section break at the end. In that document record a macro of the steps it requires to move the cursor to the end of the document, then to delete the section break. Replace the remmed out lines with the code you have created then test again. If that works substitute the lines in the original macro and let me know what you come up with. -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org DeanH wrote: Thanks for the quick response. My template is not too long, once merged the bottom line is over an inch away from the footer. Due to the information I am merging (numbers and names) the merged document never gets close to the footer. I have merged just one page, this ends with a Section Break(Continuous), all on one page. Run the macro, now ends with Section Break (Next Page) and a blank new page (obviously). Section Break (Continuous) has disappeared. I understand that the macro doesnot add the section break, but can I slot in to the macro some script to delete the Next Page before the individual file is saved? Many thanks DeanH "Graham Mayor" wrote: The macro does not *add* a section break to the document, but splits on the section break and should not do what you report. If you merge just one record does that merged document have an unwanted page? My guess is that your merge document is just a tad too long to fit on the page without forcing the final paragraph mark to a new page. Try deleting that last paragraph mark (or reformatting it as 1 point size) so that it all stays on the same page. -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org DeanH wrote: Hi Doug. The last macro (SplitMergeLetter, as I am Word2000) works wonderfully. Just one comment, what script can I add to this macro to tidy up the individual documents because they are saved with a Section Break (NextPage), and one paragraph mark for the new blank page, at the end of each file. This would just finish a wonderful job. Many thanks again. "DeanH" wrote: Many thanks Peter and Doug. I shall give these instructions a go, so cross-fingers for me. Thanks again. DeanH "Doug Robbins - Word MVP" wrote: See the "Individual Merge Letters" item on fellow MVP Graham Mayor's website at: http://www.gmayor.com/individual_merge_letters.htm If you were using Word XP or later, the "Add-in to Merge Letters to Separate Files" that I have written and that can be downloaded from that site would allow you to create each letter as a separate file with a filename taken from a field in the data source with a minimum of fuss. -- 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 "DeanH" wrote in message ... Word 2000SP3 on Windows 2000 SP4 I have set up a mail merge from an Excel source, this is not a problem. But is it possible for the merge to automatically create individual documents from the data set for each record? Also is it possible for the new individual documents to be renamed with say the "Name" field? Many thanks in advance. DeanH |
#9
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Mail Merge - create individual documents
Try
With Selection .Paste .EndKey Unit:=wdStory .TypeBackspace .TypeBackspace End With -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Graham Mayor wrote: The following macro contains the core code Sub SplitCheck() Selection.EndKey Unit:=wdStory Letters = Selection.Information(wdActiveEndSectionNumber) Selection.HomeKey Unit:=wdStory ActiveDocument.Sections.First.Range.Cut Documents.Add With Selection .Paste ' .EndKey Unit:=wdStory ' .MoveLeft Unit:=wdCharacter, Count:=1 ' .Delete Unit:=wdCharacter, Count:=1 End With End Sub The remmed out lines are the lines that are supposed to remove the errant section break. Run this macro on a merged document and see what you end up with. You should have one document with a section break at the end. In that document record a macro of the steps it requires to move the cursor to the end of the document, then to delete the section break. Replace the remmed out lines with the code you have created then test again. If that works substitute the lines in the original macro and let me know what you come up with. DeanH wrote: Thanks for the quick response. My template is not too long, once merged the bottom line is over an inch away from the footer. Due to the information I am merging (numbers and names) the merged document never gets close to the footer. I have merged just one page, this ends with a Section Break(Continuous), all on one page. Run the macro, now ends with Section Break (Next Page) and a blank new page (obviously). Section Break (Continuous) has disappeared. I understand that the macro doesnot add the section break, but can I slot in to the macro some script to delete the Next Page before the individual file is saved? Many thanks DeanH "Graham Mayor" wrote: The macro does not *add* a section break to the document, but splits on the section break and should not do what you report. If you merge just one record does that merged document have an unwanted page? My guess is that your merge document is just a tad too long to fit on the page without forcing the final paragraph mark to a new page. Try deleting that last paragraph mark (or reformatting it as 1 point size) so that it all stays on the same page. -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org DeanH wrote: Hi Doug. The last macro (SplitMergeLetter, as I am Word2000) works wonderfully. Just one comment, what script can I add to this macro to tidy up the individual documents because they are saved with a Section Break (NextPage), and one paragraph mark for the new blank page, at the end of each file. This would just finish a wonderful job. Many thanks again. "DeanH" wrote: Many thanks Peter and Doug. I shall give these instructions a go, so cross-fingers for me. Thanks again. DeanH "Doug Robbins - Word MVP" wrote: See the "Individual Merge Letters" item on fellow MVP Graham Mayor's website at: http://www.gmayor.com/individual_merge_letters.htm If you were using Word XP or later, the "Add-in to Merge Letters to Separate Files" that I have written and that can be downloaded from that site would allow you to create each letter as a separate file with a filename taken from a field in the data source with a minimum of fuss. -- 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 "DeanH" wrote in message ... Word 2000SP3 on Windows 2000 SP4 I have set up a mail merge from an Excel source, this is not a problem. But is it possible for the merge to automatically create individual documents from the data set for each record? Also is it possible for the new individual documents to be renamed with say the "Name" field? Many thanks in advance. DeanH |
#10
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Mail Merge - create individual documents
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 My web site www.gmayor.com Word MVP web site http://word.mvps.org Graham Mayor wrote: Try With Selection .Paste .EndKey Unit:=wdStory .TypeBackspace .TypeBackspace End With Graham Mayor wrote: The following macro contains the core code Sub SplitCheck() Selection.EndKey Unit:=wdStory Letters = Selection.Information(wdActiveEndSectionNumber) Selection.HomeKey Unit:=wdStory ActiveDocument.Sections.First.Range.Cut Documents.Add With Selection .Paste ' .EndKey Unit:=wdStory ' .MoveLeft Unit:=wdCharacter, Count:=1 ' .Delete Unit:=wdCharacter, Count:=1 End With End Sub The remmed out lines are the lines that are supposed to remove the errant section break. Run this macro on a merged document and see what you end up with. You should have one document with a section break at the end. In that document record a macro of the steps it requires to move the cursor to the end of the document, then to delete the section break. Replace the remmed out lines with the code you have created then test again. If that works substitute the lines in the original macro and let me know what you come up with. DeanH wrote: Thanks for the quick response. My template is not too long, once merged the bottom line is over an inch away from the footer. Due to the information I am merging (numbers and names) the merged document never gets close to the footer. I have merged just one page, this ends with a Section Break(Continuous), all on one page. Run the macro, now ends with Section Break (Next Page) and a blank new page (obviously). Section Break (Continuous) has disappeared. I understand that the macro doesnot add the section break, but can I slot in to the macro some script to delete the Next Page before the individual file is saved? Many thanks DeanH "Graham Mayor" wrote: The macro does not *add* a section break to the document, but splits on the section break and should not do what you report. If you merge just one record does that merged document have an unwanted page? My guess is that your merge document is just a tad too long to fit on the page without forcing the final paragraph mark to a new page. Try deleting that last paragraph mark (or reformatting it as 1 point size) so that it all stays on the same page. -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org DeanH wrote: Hi Doug. The last macro (SplitMergeLetter, as I am Word2000) works wonderfully. Just one comment, what script can I add to this macro to tidy up the individual documents because they are saved with a Section Break (NextPage), and one paragraph mark for the new blank page, at the end of each file. This would just finish a wonderful job. Many thanks again. "DeanH" wrote: Many thanks Peter and Doug. I shall give these instructions a go, so cross-fingers for me. Thanks again. DeanH "Doug Robbins - Word MVP" wrote: See the "Individual Merge Letters" item on fellow MVP Graham Mayor's website at: http://www.gmayor.com/individual_merge_letters.htm If you were using Word XP or later, the "Add-in to Merge Letters to Separate Files" that I have written and that can be downloaded from that site would allow you to create each letter as a separate file with a filename taken from a field in the data source with a minimum of fuss. -- 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 "DeanH" wrote in message ... Word 2000SP3 on Windows 2000 SP4 I have set up a mail merge from an Excel source, this is not a problem. But is it possible for the merge to automatically create individual documents from the data set for each record? Also is it possible for the new individual documents to be renamed with say the "Name" field? Many thanks in advance. DeanH |
#11
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Mail Merge - create individual documents
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" wrote: 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 My web site www.gmayor.com Word MVP web site http://word.mvps.org Graham Mayor wrote: Try With Selection .Paste .EndKey Unit:=wdStory .TypeBackspace .TypeBackspace End With Graham Mayor wrote: The following macro contains the core code Sub SplitCheck() Selection.EndKey Unit:=wdStory Letters = Selection.Information(wdActiveEndSectionNumber) Selection.HomeKey Unit:=wdStory ActiveDocument.Sections.First.Range.Cut Documents.Add With Selection .Paste ' .EndKey Unit:=wdStory ' .MoveLeft Unit:=wdCharacter, Count:=1 ' .Delete Unit:=wdCharacter, Count:=1 End With End Sub The remmed out lines are the lines that are supposed to remove the errant section break. Run this macro on a merged document and see what you end up with. You should have one document with a section break at the end. In that document record a macro of the steps it requires to move the cursor to the end of the document, then to delete the section break. Replace the remmed out lines with the code you have created then test again. If that works substitute the lines in the original macro and let me know what you come up with. DeanH wrote: Thanks for the quick response. My template is not too long, once merged the bottom line is over an inch away from the footer. Due to the information I am merging (numbers and names) the merged document never gets close to the footer. I have merged just one page, this ends with a Section Break(Continuous), all on one page. Run the macro, now ends with Section Break (Next Page) and a blank new page (obviously). Section Break (Continuous) has disappeared. I understand that the macro doesnot add the section break, but can I slot in to the macro some script to delete the Next Page before the individual file is saved? Many thanks DeanH "Graham Mayor" wrote: The macro does not *add* a section break to the document, but splits on the section break and should not do what you report. If you merge just one record does that merged document have an unwanted page? My guess is that your merge document is just a tad too long to fit on the page without forcing the final paragraph mark to a new page. Try deleting that last paragraph mark (or reformatting it as 1 point size) so that it all stays on the same page. -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org DeanH wrote: Hi Doug. The last macro (SplitMergeLetter, as I am Word2000) works wonderfully. Just one comment, what script can I add to this macro to tidy up the individual documents because they are saved with a Section Break (NextPage), and one paragraph mark for the new blank page, at the end of each file. This would just finish a wonderful job. Many thanks again. "DeanH" wrote: Many thanks Peter and Doug. I shall give these instructions a go, so cross-fingers for me. Thanks again. DeanH "Doug Robbins - Word MVP" wrote: See the "Individual Merge Letters" item on fellow MVP Graham Mayor's website at: http://www.gmayor.com/individual_merge_letters.htm If you were using Word XP or later, the "Add-in to Merge Letters to Separate Files" that I have written and that can be downloaded from that site would allow you to create each letter as a separate file with a filename taken from a field in the data source with a minimum of fuss. -- 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 "DeanH" wrote in message ... Word 2000SP3 on Windows 2000 SP4 I have set up a mail merge from an Excel source, this is not a problem. But is it possible for the merge to automatically create individual documents from the data set for each record? Also is it possible for the new individual documents to be renamed with say the "Name" field? Many thanks in advance. DeanH |
#12
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Mail Merge - create individual documents
It was an old version, aimed primarily at users who cannot access the
add-in, but it should have worked as it stands. As long as we got there in the end -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org DeanH wrote: 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" wrote: 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 My web site www.gmayor.com Word MVP web site http://word.mvps.org Graham Mayor wrote: Try With Selection .Paste .EndKey Unit:=wdStory .TypeBackspace .TypeBackspace End With Graham Mayor wrote: The following macro contains the core code Sub SplitCheck() Selection.EndKey Unit:=wdStory Letters = Selection.Information(wdActiveEndSectionNumber) Selection.HomeKey Unit:=wdStory ActiveDocument.Sections.First.Range.Cut Documents.Add With Selection .Paste ' .EndKey Unit:=wdStory ' .MoveLeft Unit:=wdCharacter, Count:=1 ' .Delete Unit:=wdCharacter, Count:=1 End With End Sub The remmed out lines are the lines that are supposed to remove the errant section break. Run this macro on a merged document and see what you end up with. You should have one document with a section break at the end. In that document record a macro of the steps it requires to move the cursor to the end of the document, then to delete the section break. Replace the remmed out lines with the code you have created then test again. If that works substitute the lines in the original macro and let me know what you come up with. DeanH wrote: Thanks for the quick response. My template is not too long, once merged the bottom line is over an inch away from the footer. Due to the information I am merging (numbers and names) the merged document never gets close to the footer. I have merged just one page, this ends with a Section Break(Continuous), all on one page. Run the macro, now ends with Section Break (Next Page) and a blank new page (obviously). Section Break (Continuous) has disappeared. I understand that the macro doesnot add the section break, but can I slot in to the macro some script to delete the Next Page before the individual file is saved? Many thanks DeanH "Graham Mayor" wrote: The macro does not *add* a section break to the document, but splits on the section break and should not do what you report. If you merge just one record does that merged document have an unwanted page? My guess is that your merge document is just a tad too long to fit on the page without forcing the final paragraph mark to a new page. Try deleting that last paragraph mark (or reformatting it as 1 point size) so that it all stays on the same page. -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org DeanH wrote: Hi Doug. The last macro (SplitMergeLetter, as I am Word2000) works wonderfully. Just one comment, what script can I add to this macro to tidy up the individual documents because they are saved with a Section Break (NextPage), and one paragraph mark for the new blank page, at the end of each file. This would just finish a wonderful job. Many thanks again. "DeanH" wrote: Many thanks Peter and Doug. I shall give these instructions a go, so cross-fingers for me. Thanks again. DeanH "Doug Robbins - Word MVP" wrote: See the "Individual Merge Letters" item on fellow MVP Graham Mayor's website at: http://www.gmayor.com/individual_merge_letters.htm If you were using Word XP or later, the "Add-in to Merge Letters to Separate Files" that I have written and that can be downloaded from that site would allow you to create each letter as a separate file with a filename taken from a field in the data source with a minimum of fuss. -- 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 "DeanH" wrote in message ... Word 2000SP3 on Windows 2000 SP4 I have set up a mail merge from an Excel source, this is not a problem. But is it possible for the merge to automatically create individual documents from the data set for each record? Also is it possible for the new individual documents to be renamed with say the "Name" field? Many thanks in advance. DeanH |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Mail Merge Question: how to save individual files after merging | Mailmerge | |||
Mail merge in Word from Outlook Catagories | Mailmerge | |||
Can't get Word 2003 to keep data file with mail merge main documen | Mailmerge | |||
print mail merge documents that are mult ipaged | Mailmerge | |||
Saving all individual documents created by a mail merge | Mailmerge |