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 / November 2007

Tip: Looking for answers? Try searching our database.

Trouble with First Page Different in a Word Document Macro

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Cathy DeMaggio - 20 Nov 2007 20:03 GMT
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.
Doug Robbins - Word MVP - 21 Nov 2007 02:16 GMT
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.

Signature

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

>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
[quoted text clipped - 12 lines]
>I hope you can help, because I've tried everything.  Thank you for your
>time.
Cathy DeMaggio - 21 Nov 2007 15:45 GMT
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?
> 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
[quoted text clipped - 22 lines]
>>by example, so this is difficult for me. I hope you can help, because I've
>>tried everything.  Thank you for your time.
Doug Robbins - Word MVP - 21 Nov 2007 19:38 GMT
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

Signature

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

> 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
[quoted text clipped - 36 lines]
>>>by example, so this is difficult for me. I hope you can help, because
>>>I've tried everything.  Thank you for your time.
Cathy DeMaggio - 27 Nov 2007 19:47 GMT
Thank you, Doug, this worked!
> Where was the selection when you ran it?
>
[quoted text clipped - 47 lines]
>>>>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.
 
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.