Headers: in landscape or portrait page?

C

cmbrown

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

Lene Fredborg

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
 
C

cmbrown

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
 
C

cmbrown

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?
 

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