Last year I got considerable help in sending emails with 2 attachments. This year I have hit a snag. When I merge one of my attachments (see A) into a document with all the different individual forms in one document (see one such form in B) there is some distortion of the layout. But when I use the Macro SplitMergeForm it distorts the layout even more (see C which is the form to be attached to the emails).
Is there any way that the original layout can be maintained for the attachment?
My macro is as follows -
Code:
Sub SplitMergeForm()
'
' SplitMergeForm Macro
'
' splitter Macro modified to save individual Gift Aid (and Tax) Allocation Forms with
' information from data source. The filename data must be added to
' the top of the merge letter - see web article.
Dim sName As String
Dim docName As String
Dim Letters As String
Dim Counter As Long
Dim oDoc As Document
Dim oNewDoc As Document
Set oDoc = ActiveDocument
oDoc.Save
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 = "C:\Our Folders\BWMC\Form " & sName & ".doc"
oDoc.Sections.First.Range.Cut
Set oNewDoc = 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
oNewDoc.SaveAs FileName:=docName, _
FileFormat:=wdFormatDocument, _
AddToRecentFiles:=False
ActiveWindow.Close
Counter = Counter + 1
Application.ScreenUpdating = True
Wend
oDoc.Close wdDoNotSaveChanges
End Sub