Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Nov 2003
    Location
    Bloomington, Minnesota, USA
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Insert Landscape Page macro

    I'm using Win98, Word97.
    I want to create a macro to insert a landscape page in a portrait document, unlink the inserted landscape section from the previous section,unlink the next section from the landscape section, make the page numbering continuous, and adjust the headers/footers from 6.5" to 9" for the landscape section.

    I only know how to record macros & do some deletion of extraneous text.

    My footer is a two column, one row table.
    I'm able to make this work if I use two macros. One will do everything but change the headers & footers for the landscape section, and the second, which must be run immediately after the first, will fix the headers & footers.

    If I try to combine the macros, the footer works as wanted, but the header changes to 9" in the section following the landscape section rather than in the landscape section.

    Any ideas?
    Macro text follows:

    Sub InsertLandscapePage()
    '
    ' Insert Landscape Page Macro
    ' Macro recorded 06/13/01 by Claudia Merriman
    '
    Selection.InsertBreak Type:=wdSectionBreakNextPage
    Selection.TypeParagraph
    Selection.TypeParagraph
    Selection.InsertBreak Type:=wdSectionBreakNextPage
    Selection.GoTo What:=wdGoToPage, Which:=wdGoToPrevious, Count:=1, Name:=""
    Selection.Find.ClearFormatting
    With Selection.PageSetup
    .Orientation = wdOrientLandscape
    .SectionStart = wdSectionNewPage
    If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
    ActiveWindow.Panes(2).Close
    End If
    If ActiveWindow.ActivePane.View.Type = wdNormalView Or ActiveWindow. _
    ActivePane.View.Type = wdOutlineView Or ActiveWindow.ActivePane.View.Type _
    = wdMasterView Then
    ActiveWindow.ActivePane.View.Type = wdPageView
    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
    With Selection.HeaderFooter.PageNumbers
    .NumberStyle = wdPageNumberStyleArabic
    .HeadingLevelForChapter = 0
    .IncludeChapterNumber = False
    .ChapterPageSeparator = wdSeparatorHyphen
    .RestartNumberingAtSection = False
    .StartingNumber = 0
    End With
    ActiveWindow.ActivePane.View.NextHeaderFooter
    With Selection.HeaderFooter.PageNumbers
    .NumberStyle = wdPageNumberStyleArabic
    .HeadingLevelForChapter = 0
    .IncludeChapterNumber = False
    .ChapterPageSeparator = wdSeparatorHyphen
    .RestartNumberingAtSection = False
    .StartingNumber = 0
    End With
    Selection.HeaderFooter.LinkToPrevious = Not Selection.HeaderFooter. _
    LinkToPrevious
    If Selection.HeaderFooter.IsHeader = True Then
    ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter
    Else
    ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
    End If
    Selection.HeaderFooter.LinkToPrevious = Not Selection.HeaderFooter. _
    LinkToPrevious
    If Selection.HeaderFooter.IsHeader = True Then
    ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter
    Else
    ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
    End If
    ActiveWindow.ActivePane.View.PreviousHeaderFooter
    Selection.HeaderFooter.LinkToPrevious = Not Selection.HeaderFooter. _
    LinkToPrevious
    If Selection.HeaderFooter.IsHeader = True Then
    ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter
    Else
    ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
    End If
    Selection.HeaderFooter.LinkToPrevious = Not Selection.HeaderFooter. _
    LinkToPrevious
    End With
    End Sub

    -------------------------------
    Sub landscapeheaderfooter()
    '
    ' landscapeheaderfooter Macro
    ' Macro recorded 06/14/01 by Claudia Merriman
    '
    ActiveWindow.ActivePane.View.NextHeaderFooter
    Selection.ParagraphFormat.tabstops(InchesToPoints( 6.5)).Clear
    If Selection.HeaderFooter.IsHeader = True Then
    ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter
    Else
    ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
    End If
    Selection.MoveDown Unit:=wdLine, Count:=2
    Selection.MoveRight Unit:=wdCell
    Selection.Cells.SetWidth ColumnWidth:=InchesToPoints(5.69), RulerStyle:= _
    wdAdjustNone
    Selection.Rows.SpaceBetweenColumns = InchesToPoints(0.15)
    End Sub

  2. #2
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts

    Re: Insert Landscape Page macro

    A far simpler way of doing this is to use an autotext entry of the same. Set up a page exactly as you require and create an autotext that includes the start and finish section breaks that border the landscape page. Make a macro of that if you like but it is a zillion times easier than the full code way you are doing it.

    If you don't fully comprehend where the page setups/Headers/Footers go when you insert text containing section breaks you need to investigate this as the understanding is critical to know whats happened after you insert this type of autotext.
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  3. #3
    New Lounger
    Join Date
    Nov 2003
    Location
    Bloomington, Minnesota, USA
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Insert Landscape Page macro

    Thanks, that was easy.

Posting Permissions

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