Hello,
I need a macro that inserts a landscape page file onto a main portrait
document report.
The inserted landscape page uses different headers and footers, so I
need the headers and footers not linked the previous and following
pages.
The user should simpley click on a page somewhere in the document and
click a ?Insert landscape? button which I will assign to the macro you
provide. It will then insert this landscape document at the bottom of
the currrent page that the cursor is on. It would be good to check if
the user has the cursor on the first page and if so then the macro
should msgbox and warn the user that they cannot insert the landscape
document here and exit the procedure.
The landscape file is located at ?g:\apps\InfoBank\Shared
Templates\LANDSCAPE.doc? on the users pc. The landscape file to be
imported contains ?fake? portrait headers and footers, that is they
are just textboxes aligned to the LHS and RHS, so I just need the
headers and footers unlinked from the previous pages on the main
document.
It seemed to be workign but now it isnt. Here is my code that ?should? do it.
Application.ScreenUpdating = False
Selection.InsertBreak Type:=wdSectionBreakNextPage
Selection.InsertBreak Type:=wdSectionBreakNextPage
Selection.MoveUp Unit:=wdLine, Count:=1
With Selection.PageSetup
.LineNumbering.Active = False
.Orientation = wdOrientLandscape
.SectionStart = wdSectionNewPage
.OddAndEvenPagesHeaderFooter = False
End With
ActiveDocument.Sections(Selection.Information(wdActiveEndSectionNumber)).Headers(wdHeaderFooterPrimary).LinkToPrevious
= False
ActiveDocument.Sections(Selection.Information(wdActiveEndSectionNumber)).Footers(wdHeaderFooterPrimary).LinkToPrevious
= False
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
Selection.InsertFile FileName:="g:\apps\InfoBank\Shared
Templates\LANDSCAPE.doc", Range:="", _
ConfirmConversions:=False, Link:=False, Attachment:=False
With Selection.PageSetup
.LineNumbering.Active = False
.Orientation = wdOrientPortrait
.SectionStart = wdSectionNewPage
.OddAndEvenPagesHeaderFooter = False
.DifferentFirstPageHeaderFooter = False
.VerticalAlignment = wdAlignVerticalTop
End With
Thanks
Peter. |