Macro to Insert Formatted Pages

E

EddieLampert

I have an Access report that I brought into word, and I want to insert two
blank pages after the first (title) page. The first inserted page (second pg
overall) I need in landscape format, and the second inserted page (third pg
overall) I need portrait, like all the other pages except #2. I can do this,
but when I record the macro for it and run it, puts the inserted pages at the
beginning, and messes up the spacing to where it adds about 10 pages to an
80pg document. Any help would be appreciated. Let me know if I should post
the code for the recorded macro. Thanks a lot.
 
D

Doug Robbins - Word MVP

The following commands will insert a landscape oriented Section after the
first page of the document, leaving the rest of the document in portrait
orientation:

Dim page1 As Range
Selection.HomeKey wdStory
Set page1 = ActiveDocument.Bookmarks("\page").Range
page1.start = page1.End
page1.InsertBreak (wdSectionBreakNextPage)
page1.InsertBreak (wdSectionBreakNextPage)
ActiveDocument.Sections(2).PageSetup.Orientation = wdOrientLandscape


--
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
 
E

EddieLampert

Thanks, Doug. That code works fine, but when I change it to add another blank
page in portrait view, it adds two additional pages, instead of one. Again,
my goal is to add after the first page one landscape and one portrait, both
blank. Any help is appreciated.
 
D

Doug Robbins - Word MVP

Use

Dim page1 As Range
Selection.HomeKey wdStory
Set page1 = ActiveDocument.Bookmarks("\page").Range
page1.start = page1.End
page1.InsertBreak (wdSectionBreakNextPage)
page1.InsertBreak (wdSectionBreakNextPage)
page1.InsertBreak
ActiveDocument.Sections(2).PageSetup.Orientation = wdOrientLandscape

That will insert two blank pages between the first page and what was
originally the second page with the first of the new pages in landscape
orientation and the second new page in portrait orientation.

--
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top