You are here:

Microsoft Word/Page layout change from portrait to landscape (vice versa)?

Advertisement


Question
Hi Anne,

I don't know, if you are able to help. It is a little bit tricky and so far nobody could help me (and I am looking for a solution many weeks yet).
You are really my last hope....

The result should be a VBA-Code, which changes the current side of a Word Document from its current layout to the other (e.g. portrait -> landscape or if it is currently landscape -> portrait). The user presses an Icon and the change take place. And only the current page should changed - nothing else (not the pages before and not the pages after...).

Are you able to explain me, how it really works? I can do it manually, therefore there must be a solition to do it automatically.


A resolution for Word2003 is:
Sub Querformat_Markierung2()
   ActiveDocument.Range(Start:=Selection.Start, End:=Selection.Start). _
       InsertBreak Type:=wdSectionBreakNextPage
   Selection.Start = Selection.Start + 1
   ActiveDocument.Range(Start:=Selection.End, End:=Selection.End).InsertBreak _
        Type:=wdSectionBreakNextPage
   With Selection.PageSetup
       .LineNumbering.Active = False
       .Orientation = wdOrientLandscape
   End With
End Sub
but that is not working for Word XP (2000).

I can image the following could work (but it wasn't so far).
mark all at current page
change layout (for that paragraph)
unmark all

Do you think it is possible in that way?


Thank you very much in advance


Mark


Answer
Hi, Mark. I'm not coder, but I did create www.vbaexpress.com a couple of years ago for questions JUST like yours. Go register over there, and copy/paste your question as a new thread in the Word help area. It's all free, and some of the best VBA programmers in the world are there.

My problem using code to "make the current page landscape" is that Word needs to know where your section breaks should be. I would say that it would be easier for you to tell it "make landscape from here on" as one macro, then another that does "make portrait from here on". I did once create a template that had such macros in it. I can't get to VBAExpress at the moment to point out which macro it is, but it's about creating a menu in Word, it's written by smozgur, and can be found at www.vbaexpress.com/kb (but you should join first, so you can search).

Good luck, Mark!
About Microsoft Word
This topic answers questions related to Microsoft Word stand-alone or Mircrosoft Office Word including Word 2003, Word 2007, Office 2000, and Office XP. You can get Word help on formatting text, tables, tabs, fonts, styles, general Word layouts, bullets, headings, and outlines, using templates, toolbar modifications, and using Track Changes. You may also find tips on linking Word and Excel embedded objects including charts. This site does not provide a general Word tutorial nor the basics of using a word processor. It provides specific answers to using Microsoft Word only. If you do not see your Word question answered in this area then please ask a Word question here

Microsoft Word

All Answers


Answers by Expert:


Ask Experts

Volunteer


Anne Troy

Expertise

Office Articles Virtually all common questions about Microsoft Word, including all versions. Help with formatting and troubleshooting, templates and long documents.
Please: No VBA or macro questions.

Experience

Author of Dreamboat on Word and Co-Author of Office VBA: Macros You Can Use Today. Me and Word have been together for about 15 years.

©2012 About.com, a part of The New York Times Company. All rights reserved.