PDA

View Full Version : MS Word Footer Macro Different Front page



jm7sa
10-08-2008, 03:27 AM
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

macropod
10-08-2008, 09:39 PM
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.

jm7sa
10-09-2008, 09:34 AM
Thanks fot the help - I managed to come up with a solution