Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MS Word Footer Macro Different Front page

Status
Not open for further replies.

jm7sa

Technical User
Oct 8, 2008
3
GB
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....)


Code:
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
 
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

[MS MVP - Word]
 
Thanks for the help - I managed to come up with a suitable solution
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top