Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
world bible school world bible school is offline
external usenet poster
 
Posts: 1
Default put a button on a toolbar to set orientation to landscape

I want a button on the toolbar to set orientation to landscape without having
to use page setup button
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Robert M. Franz (RMF) Robert M. Franz (RMF) is offline
external usenet poster
 
Posts: 1,741
Default put a button on a toolbar to set orientation to landscape

Hi scholars

world bible school wrote:
I want a button on the toolbar to set orientation to landscape without having
to use page setup button


The following macro, put on a toolbar button (Tools | Customize |
Commands | Macros, push the macro into an existing or new taskbar -- as
long as you have access to taskbars, that is, Word 2003-related joke
:-)), changes the orientation of the section the cursor is in (or of the
first section in the selection if you have selected something):

Sub ToggleOrientation()
With Selection.Sections(1).PageSetup
If .Orientation = wdOrientLandscape _
Then .Orientation = wdOrientPortrait _
Else .Orientation = wdOrientLandscape
End With
End Sub

I have not tested this for things like what happens when the selection
is in a textbox or header etc.

For anyone more familiar with VBA than myself (which doesn't mean much
at all! :-)), the slightly shorter version taking advantage of knowing
what the wdOrient constants' values are, would be:

Sub ToggleOrientation1()
With Selection.Sections(1).PageSetup
.Orientation = 1 - .Orientation
End With
End Sub

But I have no clue whether this is as safe as the above (and it's
certainly less readable ...).

Greetinx
Robert
--
/"\ ASCII Ribbon Campaign | MS
\ / | MVP
X Against HTML | for
/ \ in e-mail & news | Word
  #3   Report Post  
Posted to microsoft.public.word.docmanagement
Cindy M. Cindy M. is offline
external usenet poster
 
Posts: 2,416
Default put a button on a toolbar to set orientation to landscape

Hi ?B?d29ybGQgYmlibGUgc2Nob29s?=,

I want a button on the toolbar to set orientation to landscape without having
to use page setup button

It appears there isn't any direct command for this that can be assigned to a
button. You'd need to use a macro assigned to a button. For example:

Sub LandscapePaper()
ActiveDocument.PageSetup.Orientation = wdOrientLandscape
End Sub

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :-)

Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
WORD 2003 color fill button does not allow selection unicorn Microsoft Word Help 15 December 8th 06 03:38 AM
Opening a file on my HDD via a Toolbar button Buck Rabbit New Users 1 July 2nd 06 02:02 AM
Modify custom toolbar button behaviour Robert Werner Microsoft Word Help 1 August 13th 05 04:20 AM
I can't delete a toolbar button from the standard toolbar GrandmaJanet Microsoft Word Help 1 May 19th 05 04:16 AM
How do I get all my Word documents within one Word window RobJacobs Microsoft Word Help 5 April 12th 05 03:04 AM


All times are GMT +1. The time now is 09:36 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"