Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / June 2007

Tip: Looking for answers? Try searching our database.

Headers: in landscape or portrait page?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
cmbrown - 24 May 2007 21:56 GMT
If my cursor is in a header, or footer, how can I determine if the respective
page is landscape or portrait? The code that returns the orientation doesn't
seem to work when I have the header selected!

Thanks!
Signature

cmbrown

Lene Fredborg - 24 May 2007 22:53 GMT
I just tested the following - it worked for me (there may be more elegant
methods).

You can use:
Selection.Information(wdActiveEndSectionNumber)
to return the section number at the _end_ of the current selection.

This means that you can use:
ActiveDocument.Sections(Selection.Information(wdActiveEndSectionNumber)).PageSetup.Orientation
to return the orientation of the section in question.
0 = portrait
1 = landscape

Note that the code is most likely broken into 2 lines when posted - change
it to 1 line.
---
Regards
Lene Fredborg
DocTools - Denmark
www.thedoctools.com
Document automation - add-ins, macros and templates for Microsoft Word

> If my cursor is in a header, or footer, how can I determine if the respective
> page is landscape or portrait? The code that returns the orientation doesn't
> seem to work when I have the header selected!
>
> Thanks!
cmbrown - 04 Jun 2007 20:57 GMT
Hi Lene, sorry for the delay in responding (I went on vacation), and thanking
you for your help. It worked great!

Thanks so much!
Chris
Signature

cmbrown

> I just tested the following - it worked for me (there may be more elegant
> methods).
[quoted text clipped - 23 lines]
> >
> > Thanks!
cmbrown - 05 Jun 2007 21:07 GMT
I spoke too soon, I now have another problem...

I am trying (in Word 2003) to get some code to work that inserts a landscape
page and formats the headers and footers. (Only new tabs, to adjust for the
wider margins.) The problem is that, whenever I access the headers, and do a
select.whoestory, the PREVIOUS section is selected, no matter what I try.

I have no idea why this happens. I can step through the code, and when I
access the header, I can see the cursor is in the landscape header, but then
when I try to do ANYTHING to the header, the cursor jumps to the previous
section.

Any ideas?
Signature

cmbrown

> Hi Lene, sorry for the delay in responding (I went on vacation), and thanking
> you for your help. It worked great!
[quoted text clipped - 29 lines]
> > >
> > > Thanks!
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.