Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Help needed Word Marco to insert second doc to orginal  (Read 3068 times)

0 Members and 1 Guest are viewing this topic.

petreli

    Topic Starter


    Rookie

    Help needed Word Marco to insert second doc to orginal
    « on: June 08, 2009, 06:05:32 AM »
    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