Trouble with First Page Different in a Word Document Macro

C

Cathy DeMaggio

I have a memo template with the company logo on the first page in a header
and nothing in the footer. If the memo goes more than one page, from page 2
to the end have no header, but do have a footer with the page number and a
smaller company logo. Because of this, First Page Different is checked off
in Page Setup. Some people want to be able to insert a landscape table page
into the middle of the document. When they section off the document to add
these pages, the logo from the first page is displayed on their page. I am
trying to create a macro to help the staff that are trying to do this, by
having the macro insert the landscape page with the footer that is on all of
the pages other than the first page (the page number and smaller logo),
followed by a portrait page so they will be ready to type again. However, I
cannot get the macro to stop putting in the logo from the first page, even
though I have .DifferentFirstPageHeaderFooter = False. I only know how to
create macros by example, so this is difficult for me. I hope you can help,
because I've tried everything. Thank you for your time.
 
D

Doug Robbins - Word MVP

The code that you would need to prevent the header from the first page of
the document appearing on the first page of the landscape section would be

With Selection.Sections(1).Headers(wdHeaderFooterFirstPage)
.LinkToPrevious = False
.Range.Delete
End With

The selection must be in the landscape page when that macro is run.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
C

Cathy DeMaggio

Doug -- Thank you for getting back to me so quickly. I tried the macro and
it works the first time, but not when I need to use it again. For instace,
you have a few pages of text then section the document off for a landscape
page (which I have in autotext), run the macro and it works by removing the
first page header from the page you are on. But, if you type some more
pages and then need to add another landscape table page, when you use the
macro again, it goes back to the previous section and puts the first page
header in it. The new section doesn't have the header, which is what you
want, but we don't want it to go back to the last section and add it in
again. Only the first section should have that first header, then all other
sections have no header, but from page 2 on there is a footer with a page
number and smaller logo. Do you know why this is happening?
 
D

Doug Robbins - Word MVP

Where was the selection when you ran it?

You could try the following modification:

With Selection.Sections(1).Headers(wdHeaderFooterFirstPage)
If .LinkToPrevious = True then
.LinkToPrevious = False
.Range.Delete
End If
End With


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
C

Cathy DeMaggio

Thank you, Doug, this worked!
Doug Robbins - Word MVP said:
Where was the selection when you ran it?

You could try the following modification:

With Selection.Sections(1).Headers(wdHeaderFooterFirstPage)
If .LinkToPrevious = True then
.LinkToPrevious = False
.Range.Delete
End If
End With


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 

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