+ Reply to Thread
Results 1 to 3 of 3

Selecting Different First page in header footer options in a macro

  1. #1
    Registered User
    Join Date
    10-23-2017
    Location
    NS, CA
    MS-Off Ver
    2016
    Posts
    17

    Selecting Different First page in header footer options in a macro

    Hi So I have a slightly different but related question to my previous post. I have gotten a working macro which will add a header, footer and watermark to a document but it only works when the different first page option is selected.
    Since I only want to add the header, footer and watermark to the first page of any document that is not a problem.
    My problem is I dont know how to get the marco to set the different first page header/footer option to true, so i dont have to go in and set it myself.

    This is the current working macro:

    Sub AddHFW()

    'Add Header
    'Add Footer
    'Add Watermark
    'additions based on company header, footer, and watermark

    'Need code here to set different first page option to true

    With ActiveDocument.Sections.First.Headers(wdHeaderFooterFirstPage)
    .Shapes.AddPicture FileName:="C:\Users\AllisonWentzell\Documents\Custom Office Templates\Header.png", LinkToFile:=False, SaveWithDocument:=True, Left:=-75, Top:=-35, Width:=620, Height:=71
    End With

    With ActiveDocument.Sections.First.Footers(wdHeaderFooterFirstPage)
    .Shapes.AddPicture FileName:="C:\Users\AllisonWentzell\Documents\Custom Office Templates\Footer.png", LinkToFile:=False, SaveWithDocument:=True, Left:=-75, Top:=-22, Width:=620, Height:=71
    End With

    With ActiveDocument.Sections.First.Headers(wdHeaderFooterFirstPage)
    .Shapes.AddPicture FileName:="C:\Users\AllisonWentzell\Documents\Custom Office Templates\LogoF2.png", LinkToFile:=False, SaveWithDocument:=True, Left:=25, Top:=173, Width:=1700, Height:=435
    End With

    End Sub


    I am not too keen on changing what is there, though I am sure there is a more compact way to get it to work as I have been over an hour getting the pictures to be in the proper places on the page.

  2. #2
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: Selecting Different First page in header footer options in a macro

    ActiveDocument.Sections.First.PageSetup.DifferentFirstPageHeaderFooter = True
    Cheers,
    Paul Edstein
    [Fmr MS MVP - Word]

  3. #3
    Registered User
    Join Date
    10-23-2017
    Location
    NS, CA
    MS-Off Ver
    2016
    Posts
    17

    Re: Selecting Different First page in header footer options in a macro

    Well I may have been making this more complicated in my head then it actually was......

    Thank you for taking the time to answer.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Adding "page X of Y" in header/footer not working when used in macro
    By Smeghead in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 06-19-2015, 07:26 AM
  2. Have Macro Header & Footer Display on All Worksheets EXCEPT the First Page
    By caustria08 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-11-2013, 09:58 PM
  3. Replies: 5
    Last Post: 03-19-2012, 06:14 PM
  4. Header on first, footer on last page?
    By alexa2 in forum Excel General
    Replies: 2
    Last Post: 03-12-2009, 05:36 PM
  5. locking page layout and header and footer options
    By khokhart in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-13-2008, 02:26 PM
  6. [SOLVED] Header / Footer options
    By Doug in forum Excel General
    Replies: 0
    Last Post: 04-20-2006, 10:00 AM
  7. How do I delete the drop down list of header / footer options in e
    By Progress Finance in forum Excel General
    Replies: 1
    Last Post: 12-01-2005, 02:55 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1