View Single Post
Old 06-22-2022, 12:42 AM
naccettolo naccettolo is offline Mac OS X Office 2016 for Mac
Join Date: Jun 2022
Posts: 1
naccettolo is on a distinguished road
Default De-flag "move image with text"

Hello everybody, I'm new to this forum. I'm struggling a lot in order to find a VBA command and after searching a lot I wasn't able to find an answer.
I'm positioning an image on all pages of a word document with the below macro.
I have to do this instead of inserting the image as footer as I want to maintain the hyperlink: if I click on the image the hyperlink bring me on top of the document.
The problem is that when I save the file as pdf the some pages "lost" the image and the problem is due to the flag "Move image with text" that is present.
Do you know how to de-flag "Move image with text"?
Thanks a lot in advance
(I'm using Word on Mac version 16.62)

Sub LOGO1()

Dim Rng As Range, i As Long, Shp As Shape, ImageName As String
ImageName = "/Users/federicopannacci/Desktop/bcube_logo.png"
With ActiveDocument
Set Rng = .Range(0, 0)
For i = 1 To .ComputeStatistics(wdStatisticPages)
Set Rng = Rng.GoTo(What:=wdGoToPage, Name:=i)
Set Rng = Rng.GoTo(What:=wdGoToBookmark, Name:="\page")
Rng.Collapse wdCollapseStart

Set Shp = .InlineShapes.AddPicture(FileName:=ImageName, SaveWithDocument:=True, Range:=Rng).ConvertToShape
With Shp
.LockAspectRatio = True
.Left = CentimetersToPoints(6)
.Top = CentimetersToPoints(25)
.Width = 95
.Height = 45
.WrapFormat.Type = wdWrapBehind
.LockAnchor = True
End With
.Hyperlinks.Add Shp, SubAddress:="_top"
End With

End Sub
Reply With Quote