Results 1 to 10 of 10
  1. #1
    New Lounger
    Join Date
    Sep 2011
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Footer on first page is without values ???

    XLSX file has a macro which is using word document template to produce quote. In the final quotation page 1 footer is without values and on page 2 values are there.???

    VBA code in my excel worksheet

    Code:
    'Add Footer Details
    500 appWord.ActiveWindow.ActivePane.View.SeekView = mConst_wdSeekPrimaryFooter
        intResponse = gfnc_booReplaceCode(appWord, CStr(wrkCurr.Sheets("Documents").Cells(4, 2).Value), "{ProjectRef}")
        intResponse = gfnc_booReplaceCode(appWord, CStr(wrkCurr.Sheets("Documents").Cells(2, 2).Value & " Rev " & CStr(wrkCurr.Sheets("Documents").Cells(3, 2).Value)), "{QuoteNo}")
        intResponse = gfnc_booReplaceCode(appWord, Format(dtQuoteDate, "Long Date"), "{Date}")
        appWord.ActiveWindow.ActivePane.View.SeekView = mConst_wdSeekMainDocument
    Last edited by jscher2000; 2011-09-10 at 13:27. Reason: Split to new thread, added [code][/code] around code to preserve indenting

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts
    I moved your post to its own thread because it seems to present a different question than the earlier one (Different First Page 2007).

    When you insert into the "primary" footer, that will cover all pages unless the document has the option set to have a different footer on the first page. To use the same footer on all pages, visit the Page Setup dialog, Layout tab, and clear the checkbox under Headers and Footers for different first page.

    If you do want a different first page footer, you will need to adjust your code. However, your code uses functions that are unfamiliar to me. Can you post a workbook that is stripped down to just enough code to understand what it is supposed to do (but also compiles successfully so it can be tested and tweaked)?
    Last edited by jscher2000; 2011-09-10 at 13:32. Reason: Rewritten with new emphasis.

  3. #3
    New Lounger
    Join Date
    Sep 2011
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    First page footer issue

    Thanks for moving my post.

    Yes i have a different first page header so i have to choose different firstpage header/footer. Actually footer is same on all pages but in word there is no option of choosing only diff first page header.

    Thanks for your help.

    Hope i can solve this issue with ur help.

    basically the footer takes values from worksheet.

    footer template pasted below;
    Project Reference : {ProjectRef} Tel: xxxxxxxxxxxxxxxx
    Quotation Reference : {QuoteNo} Fax: xxxxxxxxxxxxxxxxx
    Date: : {Date} Page 1 of 4 Email: aaaaaaaaaaaaaaaa

  4. #4
    Silver Lounger Charles Kenyon's Avatar
    Join Date
    Jan 2001
    Location
    Sun Prairie, Wisconsin, Wisconsin, USA
    Posts
    2,049
    Thanks
    124
    Thanked 119 Times in 116 Posts
    Your application needs to insert the data into the first page footer as well as the footer.
    Charles Kyle Kenyon
    Madison, Wisconsin

  5. #5
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,055
    Thanks
    2
    Thanked 417 Times in 346 Posts
    Quote Originally Posted by Raksha View Post
    Yes i have a different first page header so i have to choose different firstpage header/footer. Actually footer is same on all pages but in word there is no option of choosing only diff first page header.
    If there is no risk of the pagebreak between the first two pages varying as a result of edits on the 1st page, you could use a std page layout and a 'next page' Section break at the bottom of page 1. That will allow you to unlink the page 2 header from the page 1 header whilst leaving the footers linked. Then, when you insert the header content on page 1, that's the only place it will appear.
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  6. #6
    New Lounger
    Join Date
    Sep 2011
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Application code

    Thanks Charles.

    Do you know VBA code for firstpagefooter?

    thanks


    Quote Originally Posted by Charles Kenyon View Post
    Your application needs to insert the data into the first page footer as well as the footer.

  7. #7
    Silver Lounger Charles Kenyon's Avatar
    Join Date
    Jan 2001
    Location
    Sun Prairie, Wisconsin, Wisconsin, USA
    Posts
    2,049
    Thanks
    124
    Thanked 119 Times in 116 Posts
    Nope. I would try recording a macro to find it. Might work.


    Tried it, it does not.
    Last edited by Charles Kenyon; 2011-09-11 at 23:01. Reason: update
    Charles Kyle Kenyon
    Madison, Wisconsin

  8. #8
    Silver Lounger Charles Kenyon's Avatar
    Join Date
    Jan 2001
    Location
    Sun Prairie, Wisconsin, Wisconsin, USA
    Posts
    2,049
    Thanks
    124
    Thanked 119 Times in 116 Posts
    I took the liberty of posting your question on the Microsoft website. The people who responded are vba experts. I am merely a tinkerer. The answers received are:

    from Hans V

    I guess it'd be

    appWord.ActiveWindow.ActivePane.View.SeekView = mConst_wdSeekFirstPageFooter

    where

    mConst_wdSeekFirstPageFooter = 5

    See for example http://msdn.microsoft.com/en-us/library/microsoft.office.interop.word.wdseekview(v=office. 11).aspx (it's for Word 2003 but it's the same for Word 2010)

    ---
    From Graham Mayor

    If you are addressing the footer(s) from vba, then you would be better addressing the footer ranges rather than actually entering the footer. There are potentially three header/footer ranges for each section of the document - first page, primary, and even pages. The following will address each of them for each section.

    Code:
    Dim oSection As Section
    Dim oFooter As HeaderFooter
    Dim oRng As Range
    For Each oSection In ActiveDocument.Sections
        For Each oFooter In oSection.Footers
            If oFooter.Exists Then
                Set oRng = oFooter.Range
                Select Case oFooter.Index
                    Case Is = wdHeaderFooterPrimary
                        oRng.Text = "This is the primary footer"
                    Case Is = wdHeaderFooterFirstPage
                        oRng.Text = "This is the first page footer"
                    Case Is = wdHeaderFooterEvenPages
                        oRng.Text = "This is the even page footer"
                End Select
            End If
        Next oFooter
    Next oSection
    This was posted at
    http://answers.microsoft.com/en-us/o...e-31bef513b962

    Please let me know if this helps.

    PS Here is a link to the customization forum at Microsoft:
    http://answers.microsoft.com/en-us/o...tomize?tab=all
    Last edited by Charles Kenyon; 2011-09-12 at 08:10. Reason: add link
    Charles Kyle Kenyon
    Madison, Wisconsin

  9. #9
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,055
    Thanks
    2
    Thanked 417 Times in 346 Posts
    You really wouldn't want to use the 'SeekView' approach - it introduces other complications, including the need to 'seek' back to the body of the document.

    At it's simplest, you could use something like:
    ActiveDocument.Sections(1).Headers(wdHeaderFooterF irstPage).Range.Text = "Hello World"
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  10. #10
    New Lounger
    Join Date
    Sep 2011
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    First page footer issue Solved :)

    Thanks to all of you who replied to my query.

    With bits and pieces received as feedback and experiment with the code, I successfully solved my issue.

    Thanks once again to all who helped me to achieve this.

    Regards
    Raksha

Posting Permissions

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