Hi all
I've used Peter Hewetts Unlink2Sections to format a new section in
landscape & I need to reposition the frame from the previous section
in the header.
my macro stops in the header which needs to be changed but I'm not
sure how to select the frame and format. The position needs to be
Horiz 19.11 cm relative to page & Vert: -.42 to paragraph.
I've tried inserting it as an autotext but it wouldn't work.
thanks for any help
Peta
The code that I have is below:
Sub landscapeSectionBreak()
'
Selection.InsertBreak Type:=wdSectionBreakNextPage
Call Unlink2Sections
With Selection.PageSetup
.Orientation = wdOrientLandscape
.LeftMargin = CentimetersToPoints(2)
.RightMargin = CentimetersToPoints(2)
.HeaderDistance = CentimetersToPoints(0.63)
.FooterDistance = CentimetersToPoints(1.11)
End With
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter
Selection.MoveDown Unit:=wdParagraph, Count:=3, Extend:=wdExtend
Selection.MoveRight Unit:=wdWord, Count:=1, Extend:=wdExtend
Selection.EndKey Unit:=wdStory, Extend:=wdExtend
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Borders(wdBorderTop).LineStyle = wdLineStyleNone
Selection.Borders(wdBorderLeft).LineStyle = wdLineStyleNone
Selection.Borders(wdBorderBottom).LineStyle = wdLineStyleNone
Selection.Borders(wdBorderRight).LineStyle = wdLineStyleNone
Selection.Borders(wdBorderDiagonalDown).LineStyle =
wdLineStyleNone
Selection.Borders(wdBorderDiagonalUp).LineStyle = wdLineStyleNone
Application.DisplayAutoCompleteTips = True
NormalTemplate.AutoTextEntries("LandscapeFooter").Insert
Where:=Selection. _
Range, RichText:=True
Selection.TypeBackspace
ActiveWindow.ActivePane.HorizontalPercentScrolled = 34
Selection.ParagraphFormat.TabStops(CentimetersToPoints(15.5)).Position
= _
CentimetersToPoints(26.45)
Selection.MoveLeft Unit:=wdCharacter, Count:=1
Selection.TypeText Text:=vbTab
'ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
'need to select current header's frame & format position
____
Public Sub Unlink2Sections() 'Peter Hewett
Dim lngCurrentSection As Long
lngCurrentSection = GetCurrentSection
With ActiveDocument.Sections
.Item(lngCurrentSection).Headers(wdHeaderFooterPrimary) _
.LinkToPrevious = False
.Item(lngCurrentSection).Footers(wdHeaderFooterPrimary) _
.LinkToPrevious = False
If lngCurrentSection < .Count Then
.Item(lngCurrentSection +
1).Headers(wdHeaderFooterPrimary) _
.LinkToPrevious = False
.Item(lngCurrentSection +
1).Footers(wdHeaderFooterPrimary) _
.LinkToPrevious = False
End If
End With
End Sub
Private Function GetCurrentSection() As Long
Dim rngTmp As Word.Range
Set rngTmp = Selection.Range
rngTmp.MoveStart wdStory, -1
GetCurrentSection = rngTmp.Sections.Count
End Function
I have to use a frame as we want it positioned slightly to the right
of the page margin.
thanks for any assistance
peta