Loop through pages and insert header image


Joined
Dec 21, 2020
Messages
1
Reaction score
0
Hi There

I am trying to modify the following code I found online so that it inserts the same header image on to all pages in a document.
Code:
Sub TITLE()
Application.ScreenUpdating = False
Dim Shp As Shape
With ActiveDocument.Sections(1)
  With .PageSetup
    .DifferentFirstPageHeaderFooter = True
    .TopMargin = CentimetersToPoints(5)
  End With
  Set Shp = .Headers(wdHeaderFooterFirstPage).Shapes.AddPicture _
    (Filename:="H:\Logo.jpg", LinkToFile:=False, SaveWithDocument:=True)
  With Shp
    .Height = CentimetersToPoints(8.94)
    .Width = CentimetersToPoints(5.58)
    .LockAspectRatio = True
    .Left = CentimetersToPoints(-0.63)
    .Top = CentimetersToPoints(-0.27)
    .WrapFormat.AllowOverlap = True
    .WrapFormat.Side = wdWrapNone
    
  End With

  End With

Set Shp = Nothing
Application.ScreenUpdating = True
End Sub


I can't find what the code is for MS Word so that it loops through all pages in a document and selects the header.

Can you please advise how I would modify this?

Many thanks
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top