0

I have the following code:

    Sub ImageInsert()
Application.ScreenUpdating = False
Dim Rng As Range, Shp As Shape, StrImg As String
StrImg = "filepath"
Set Rng = Selection.Range
Rng.Collapse
Set Shp = ActiveDocument.InlineShapes.AddPicture(FileName:=StrImg, _
  SaveWithDocument:=True, Range:=Rng).ConvertToShape
With Shp
  .LockAspectRatio = True
  .RelativeHorizontalPosition = wdRelativeHorizontalPositionMargin
  .Left = wdShapeRight
  .RelativeVerticalPosition = wdRelativeVerticalPositionMargin
  .Top = wdShapeBottom
  .WrapFormat.Type = wdWrapTopBottom
End With
Set Rng = Nothing: Set Shp = Nothing
Application.ScreenUpdating = True
End Sub

The question is, that i want to insert the image on ALL of the pages in the document, instead of just the page of selection. I've tried changing the range, but it doesn't seem to work.

Thanks in advance!

Madter
  • 9
  • 2
  • 4
  • You would want to loop through all your headers instead, to insert the picture into all of the headers - so that it then appears on every page. – Tanya Jun 26 '18 at 03:33
  • The problem is that it has to be inserted on the right bottom corner of all pages. I already have images in both header and footer. – Madter Jun 26 '18 at 06:55
  • You should still be able to specify the exact position of the image (eg specific centimetres or points from bottom of page and right margin, or "relative to" same). – Tanya Jun 27 '18 at 01:41

1 Answers1

0

For images that you want to appear on all pages, they should be placed into the Header area. You do not need a macro to do this.

Rich Michaels
  • 2,841
  • 2
  • 11
  • 20