Results 1 to 2 of 2

Thread: Writing a line to the footer

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Oct 2005
    Posts
    27

    Writing a line to the footer

    Hi Guys....

    I'm trying to write a line of information to my documents footer (after the first page) from my database using VBA in Microsoft Word. I've noticed you can't use the bookmark method that I have been using;

    Selection.Goto what:=wdBookmark blah blah blah

    because it says "can't find bookmark."

    How can I do this?

  2. #2
    Frenzied Member
    Join Date
    May 2004
    Location
    Carlisle, PA
    Posts
    1,045

    Re: Writing a line to the footer

    I just recorded a macro to set the footer and do a Page Setup > Layout > for "different first page". Here is the result with the significant lines highlighted:
    Code:
    Sub Macro1()
    '
    ' Macro1 Macro
    ' Macro recorded 10/14/2005 by guawd1
    '
        If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
            ActiveWindow.Panes(2).Close
        End If
        If ActiveWindow.ActivePane.View.Type = wdNormalView Or ActiveWindow. _
            ActivePane.View.Type = wdOutlineView Then
            ActiveWindow.ActivePane.View.Type = wdPrintView
        End If
        ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
        If Selection.HeaderFooter.IsHeader = True Then
    
            ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter
    
        Else
            ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
        End If
    
        Selection.TypeText Text:="This is a test"
    
        ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
        With ActiveDocument.Styles(wdStyleNormal).Font
            If .NameFarEast = .NameAscii Then
                .NameAscii = ""
            End If
            .NameFarEast = ""
        End With
        With ActiveDocument.PageSetup
            .LineNumbering.Active = False
            .Orientation = wdOrientPortrait
            .TopMargin = InchesToPoints(1)
            .BottomMargin = InchesToPoints(1)
            .LeftMargin = InchesToPoints(1.25)
            .RightMargin = InchesToPoints(1.25)
            .Gutter = InchesToPoints(0)
            .HeaderDistance = InchesToPoints(0.5)
            .FooterDistance = InchesToPoints(0.5)
            .PageWidth = InchesToPoints(8.5)
            .PageHeight = InchesToPoints(11)
            .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
    End Sub
    I hope this helps you.
    Blessings in abundance,
    All the Best,
    & ENJOY!

    Art . . . . Carlisle, PA . . USA

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width