Results 1 to 2 of 2
2004-01-29, 13:58 #1
- Join Date
- Jan 2004
- Thanked 0 Times in 0 Posts
Portrait headers and footers on landscape pages (2000)
Hi there. I'm aware that this is a bit of a classic Word problem but here goes...
I wanted to be able to have portrait headers and footers (H+Fs) on landscape pages in a document so when it is printed the headers and footers are consistent on every page. So I wrote a "Switch to landscape" macro which inserts a section break and makes the following section landscape, then goes into the H+F view, unlinks them from the previous section, deletes what's there and puts in new H+Fs in vertically aligned text boxes at left and right of the page.
Then it adds an extra page and does the same thing again for the following page in order to cover both odd and even pages.
There is also another macro to revert back to portrait pages.
The problem is that it's all very slow (and unreliable - it sometimes causes Word to crash entirely). Are there any shortcuts to setting the H+Fs or do I really have to go into the Header and Footer view to set them and then do the same on a second page? Seems to override turning off ScreenUpdates and Pagination which I have used succesfully elsewhere to speed up macro execution.
Any thoughts appreciated.
2004-01-29, 14:31 #2
- Join Date
- Nov 2001
- Thanked 7 Times in 7 Posts
Re: Portrait headers and footers on landscape pages (2000)
There are two distinct ways to manipulate text in word documents using VBA.
<UL><LI>You can use the Selection object, which is what happens when you record a macro. This requires you to go to HeaderFooter view and select the appropriate text etc.
<LI>You can manipulate ranges. This is generally much quicker and more reliable, but requires you to look through the object model to find the correct things to manipulate.[/list]You can find examples of manipulating header and footer ranges by searching the VB/VBA forum for HeaderFooter