1.

Solve : Help needed Word Marco to insert second doc to orginal?

Answer»

Hi

I am currently creating a macro to insert a standard LETTER to an existing letter, however when I do so the margins and formants change:

Is it possible to insert a second letter with its own formats and margins, without affecting the orignals

This is what I have so far:

Sub AttachLetter()
'
' AttachLETTER Macro

'
    Selection.EndKey UNIT:=wdStory
    Selection.InsertBreak TYPE:=wdPageBreak
    With ActiveDocument.Styles(wdStyleNormal).Font
        If .NameFarEast = .NameAscii Then
            .NameAscii = ""
        End If
        .NameFarEast = ""
    End With
    With ActiveDocument.PageSetup
        .LineNumbering.Active = False
        .Orientation = wdOrientPortrait
        .TopMargin = CentimetersToPoints(2.54)
        .BottomMargin = CentimetersToPoints(2.54)
        .LeftMargin = CentimetersToPoints(3)
        .RightMargin = CentimetersToPoints(3)
        .Gutter = CentimetersToPoints(0)
        .HeaderDistance = CentimetersToPoints(1.27)
        .FooterDistance = CentimetersToPoints(1.27)
        .PageWidth = CentimetersToPoints(21)
        .PageHeight = CentimetersToPoints(29.7)
        .FirstPageTray = wdPrinterDefaultBin
        .OtherPagesTray = wdPrinterDefaultBin
        .SectionStart = wdSectionNewPage
        .OddAndEvenPagesHeaderFooter = False
        .DifferentFirstPageHeaderFooter = True
        .VerticalAlignment = wdAlignVerticalTop
        .SuppressEndnotes = False
        .MirrorMargins = False
        .TwoPagesOnOne = False
        .BookFoldPrinting = False
        .BookFoldRevPrinting = False
        .BookFoldPrintingSheets = 1
        .GutterPos = wdGutterPosLeft
    End With
    Selection.TypeParagraph
   
' Attaches FORM
        Selection.InsertFile FileName:="C:\Templates 2009\Template.doc", Range:="", _
         ConfirmConversions:=False, Link:=False, Attachment:=False
         
             Selection.delete Unit:=wdCharacter, Count:=1
    Selection.delete Unit:=wdCharacter, Count:=1
    Selection.delete Unit:=wdCharacter, Count:=1
End Sub



Discussion

No Comment Found