Inserting landscape pages, formatting headers/footers

C

cmbrown

In my code, I:
insert two section breaks (now three sections)
format headers and footers in section 3: no link to previous
move up to section 2
make it landscape
format headers footers: no link to previous
format headers footers: tabs

This all works fine until the last step. Even though my cursor is in the
proper (i.e. the landscape page) header, and turning off link to prev works,
when I try to do anything (in this case set some tabs) the cursor jumps up to
the header in the previous section (which is portrait).

I can't figure it out, you can step through the code and see the cursor in
the landscape page header, you can see the proper link to prev get turned
off, but then, as soon as it executes the next line of code (in this case
format tabs), the cursor jumps up to the previous section. I have tried other
formatting things, like selecting all, inserting text, etc., but no matter
what I do the cursor jumps to the prev section. I have even tried exiting the
header and going back in, no luck.

Any help would be most appreciated!
Thanks,
Chris
 
A

ArchieDog via OfficeKB.com

Hi there

If you haven't already found a more elegant solution this might help ... I
have had something similar and solved it by using realtively clumsy lonf
winded code & closing the headers between actions. For example:

Insert the section breaks
Physically move to Section 3
Change the header
Close it
Change the footer
Close it
Physically move to Section 2
Make it landscape
(You may need to go to Section 2 again at this point)
Change the header - no link to previous
Close the header
Change the footer
Close the footer
Open the header - add tabs
Close the header
Open the footer - add tabs
Close the footer

If you have already found a more elegant solution, what was it :)

Archie Dog
 
R

Russ

If you're recording a macro to do these things, they can be unreliable
because they are depending on the 'selection' object.
It is usually better to use 'ranges' and address the particular collection
object by its index and/or range.

With ActiveDocument.Sections(2).Footers(wdHeaderFooterPrimary).Range
.ParagraphFormat.TabStops.Add Position:=InchesToPoints(2), _
Alignment:=wdAlignTabCenter
End With
 

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