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!

3
  • 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
    Commented Jun 26, 2018 at 3: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
    Commented Jun 26, 2018 at 6: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
    Commented Jun 27, 2018 at 1:41

1 Answer 1

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .