#1
|
|||
|
|||
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" Next End With End Sub |
#2
|
||||
|
||||
For example:
Code:
Sub LOGO1() Application.ScreenUpdating = False Dim Rng As Range, i As Long, Shp As Shape, ImageName As String ImageName = "/Users/federicopannacci/Desktop/bcube_logo.png" With ActiveDocument For i = 1 To .ComputeStatistics(wdStatisticPages) Set Rng = .Range.GoTo(What:=wdGoToPage, Name:=i) Set Shp = .Shapes.AddPicture(FileName:=ImageName, LinkToFile:=False, Anchor:=Rng, _ Top:=CentimetersToPoints(25), Left:=CentimetersToPoints(6), Width:=95, Height:=45) With Shp .LockAspectRatio = True .WrapFormat.Type = wdWrapBehind .LockAnchor = True .RelativeHorizontalPosition = wdRelativeHorizontalPositionPage .RelativeVerticalPosition = wdRelativeVerticalPositionPage End With .Hyperlinks.Add Anchor:=Shp, SubAddress:="_top" Next End With Application.ScreenUpdating = True End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
Tags |
image layout, move with text |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
"Magic" indentation for "too-long" text-lines that are longer than one line | pGrnd | Word | 2 | 04-20-2020 03:23 PM |
Change default move row behavior to "shift-move" | JoshM | Excel | 2 | 10-05-2018 05:06 AM |
onenote no "copy text from image" option | vinci | OneNote | 0 | 02-29-2016 01:53 AM |
Image Disappearing With "In Line With Text" Option | lax828 | Word | 6 | 08-21-2014 08:49 AM |
Why the "decrease indent" doesn't affect the selected text to move???? | Jamal NUMAN | Word | 0 | 07-12-2011 04:10 PM |