Consulting

Results 1 to 3 of 3

Thread: MS Word Footer Macro Different Front page

  1. #1
    VBAX Newbie
    Joined
    Oct 2008
    Posts
    2
    Location

    MS Word Footer Macro Different Front page

    Hello,

    I am trying to write a simple macro for MS Word (I'm using 2007 but would like it to work for 2003 too ideally)

    The macro should:

    1. insert a website address and company details into the footer of the first page of a document and then
    2. insert a logo into the footer of all subsequent pages.

    I'm a bit of a newbie and I've tried to record a macro to do this but it puts everything into the first footer.

    I have searched through these forums and come up with a macro that lets me place text into the first page only - but I can't then add the alternative footer for subsequent pages.

    Here's my macro (apologies in advance....)


    Sub footer() 
    ' 
    ' footer Macro 
    ' 
    ' 
    
    ActiveDocument.PageSetup.DifferentFirstPageHeaderFooter = True 
    WordBasic.ViewFooterOnly 
    Selection.Font.Size = 8 
    Selection.ParagraphFormat.Alignment = wdAlignParagraphRight 
    Selection.TypeText Text:= _ 
    "MY WEBSITE ADDRESS AND COMPANY DETAILS" 
    If ActiveWindow.View.SplitSpecial = wdPaneNone Then 
    ActiveWindow.ActivePane.View.Type = wdPrintView 
    Else 
    ActiveWindow.View.Type = wdPrintView 
    WordBasic.ViewFooterOnly 
    Selection.InlineShapes.AddPicture FileName:= _ 
    "C:\images\mylogo.jpg", _ 
    LinkToFile:=False, SaveWithDocument:=True 
    End If 
    
    End Sub

  2. #2
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,435
    Location
    Hi jm7sa,

    Is there a reason you can't use a Word template with the format you need? That would be a very simple solution to implement - and no vba would be required.
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

  3. #3
    VBAX Newbie
    Joined
    Oct 2008
    Posts
    2
    Location
    Thanks fot the help - I managed to come up with a solution

Posting Permissions

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