Prev: Event ID: 2001 Source Microsoft Office 11.
Next: Preview doesn't work in Open dialog window Office 2007
From: ElsaElsa on 5 Nov 2009 07:20 I have set up a mail merge to merge letters into individual documents so it would produce a long document with the merged data in it. That document will then be split into individual documents that are named by a field in the merged document. I would like to know how to set printing preferences for individual documents that have been created from the merged document. Am I correct in assuming that they will inherit the properties from the merged documents? also, after I have created the individual documents from the mail merge, the formatting seems to go awol a bit . The way the script that I use works, is that it takes the first line in the document, uses it as a document name and then deletes the field. This shouldn't effect formatting more than by one line. Yet, it makes the table in the document a lot bigger, thus it now takes 3 pages as opposed to 2 pages. I am guessing that it has something to do with the table properties, is there a way of keeping the size of the original table after using a macro to create individual files? The script that I'm using is this: 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 'Documents are based on the Normal template 'To use an alternative template follow the link. With Selection .Paste .HomeKey Unit:=wdStory .MoveDown Unit:=wdLine, Count:=1, Extend:=wdExtend .Delete End With ActiveDocument.SaveAs FileName:=Docname, _ FileFormat:=wdFormatDocument ActiveWindow.Close Counter = Counter + 1 Application.ScreenUpdating = True Wend End Sub on a completely unrelated note, I have been trying to find ways to create a global template that would save the script above in a shared network and was wondering if anyone has any advice on this. I would be very very thankful for any advice on these problems. |