Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 06-22-2022, 12:42 AM
naccettolo naccettolo is offline De-flag "move image with text" Mac OS X De-flag "move image with text" Office 2016 for Mac
Novice
De-flag "move image with text"
 
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"
Next
End With



End Sub
Reply With Quote
  #2  
Old 06-22-2022, 11:33 PM
macropod's Avatar
macropod macropod is offline De-flag "move image with text" Windows 10 De-flag "move image with text" Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,506
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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]
Reply With Quote
Reply

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

Other Forums: Access Forums

All times are GMT -7. The time now is 06:27 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2022, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2022 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft