From: aehan on 17 May 2010 06:15 I'm having trouble programming a template to insert a new A3 landscape page within an existing A4 portrait page. I want to produce A4/A3/A4 where the A4 page already has text. I have done this successfully (well it seems to be) with A4 Portrait/A4 Landscap/A4 Portrait, and have been trying unsuccessfully to do the same with A3 Landscape for days! Can anyone help? The code I am using (and I know it's probably inefficient) is: Sub InsertA3Landscape() With Selection .InsertNewPage .InsertBreak Type:=wdSectionBreakContinuous End With With Selection.PageSetup .Orientation = wdOrientLandscape .PageWidth = 1190.6 .PageHeight = 841.8 End With Selection.GoTo what:=wdGoToPage, which:=wdGoToPrevious If Selection.PageSetup.Orientation = wdOrientPortrait And Selection.PageSetup.PageWidth = 595.3 And _ Selection.PageSetup.PageHeight = 841.9 Then With Selection .GoTo Page, which:=wdGoToNext .GoTo Page, which:=wdGoToNext .InsertBreak Type:=wdSectionBreakContinuous .GoTo Break, which:=wdGoToNext .Delete Unit:=wdCharacter, Count:=2 .PageSetup.Orientation = wdOrientPortrait And Selection.PageSetup.PageWidth = 595.3 And _ Selection.PageSetup.PageHeight = 841.9 .GoTo Page, , Count:=-1 End With End If End Sub Any ideas would be really welcome and appreciated. Thank you Aehan
From: Doug Robbins - Word MVP on 17 May 2010 17:36 Use Selection.InsertBreak wdSectionBreakNextPage With Selection.Sections(1).PageSetup .Orientation = wdOrientLandscape .PaperSize = wdPaperA3 End With -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP, originally posted via msnews.microsoft.com "aehan" <aehan(a)discussions.microsoft.com> wrote in message news:532114E8-B32E-4390-AC00-6A7760050A5C(a)microsoft.com... > I'm having trouble programming a template to insert a new A3 landscape > page > within an existing A4 portrait page. I want to produce A4/A3/A4 where > the > A4 page already has text. I have done this successfully (well it seems to > be) with A4 Portrait/A4 Landscap/A4 Portrait, and have been trying > unsuccessfully to do the same with A3 Landscape for days! Can anyone > help? > The code I am using (and I know it's probably inefficient) is: > > Sub InsertA3Landscape() > > With Selection > .InsertNewPage > .InsertBreak Type:=wdSectionBreakContinuous > End With > > With Selection.PageSetup > .Orientation = wdOrientLandscape > .PageWidth = 1190.6 > .PageHeight = 841.8 > End With > > Selection.GoTo what:=wdGoToPage, which:=wdGoToPrevious > > If Selection.PageSetup.Orientation = wdOrientPortrait And > Selection.PageSetup.PageWidth = 595.3 And _ > Selection.PageSetup.PageHeight = 841.9 Then > With Selection > .GoTo Page, which:=wdGoToNext > .GoTo Page, which:=wdGoToNext > .InsertBreak Type:=wdSectionBreakContinuous > .GoTo Break, which:=wdGoToNext > .Delete Unit:=wdCharacter, Count:=2 > .PageSetup.Orientation = wdOrientPortrait And > Selection.PageSetup.PageWidth = 595.3 And _ > Selection.PageSetup.PageHeight = 841.9 > .GoTo Page, , Count:=-1 > End With > End If > > End Sub > > Any ideas would be really welcome and appreciated. > > Thank you > Aehan
|
Pages: 1 Prev: Unprotect Documents Next: Code only works fully when run from VBA editor |