Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 12-09-2020, 02:31 PM
eduzs eduzs is offline Wrap each image behind text Windows 10 Wrap each image behind text Office 2019
Expert
Wrap each image behind text
 
Join Date: May 2017
Posts: 262
eduzs is on a distinguished road
Default Wrap each image behind text

Hi there!


I need to a macro that wrap behind text all shapes of a document (also in headers).
I can't figure out how to do it exactly.
Thanks.
__________________
Backup your original file before doing any modification.
Reply With Quote
  #2  
Old 12-09-2020, 04:52 PM
gmaxey gmaxey is online now Wrap each image behind text Windows 10 Wrap each image behind text Office 2016
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,429
gmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the rough
Default

You would start by writing some code!!
The start for the inline and floating shapes in the maintext storyrange is shown below. It is now up to you to extend that to the headers.


Code:
Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
Dim oILS As InlineShape
Dim oShp As Shape
  For Each oILS In ActiveDocument.InlineShapes
    oILS.ConvertToShape
  Next oILS
  For Each oShp In ActiveDocument.Shapes
    oShp.WrapFormat.Type = wdWrapBehind
  Next oShp
lbl_Exit:
  Exit Sub
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
  #3  
Old 12-10-2020, 01:44 AM
eduzs eduzs is offline Wrap each image behind text Windows 10 Wrap each image behind text Office 2019
Expert
Wrap each image behind text
 
Join Date: May 2017
Posts: 262
eduzs is on a distinguished road
Default

Based on your code, this seems to works fine:

Code:
Dim hf As HeaderFooter, oShp As Shape, oSec As Section

For Each oSec In ActiveDocument.Sections
    For Each hf In oSec.Headers
        If hf.Exists Then
            For Each oShp In hf.Shapes
               oShp.WrapFormat.Type = wdWrapBehind
            Next oShp
        End If
    Next hf
Next oSec
Thanks!
__________________
Backup your original file before doing any modification.
Reply With Quote
  #4  
Old 12-10-2020, 07:59 AM
gmaxey gmaxey is online now Wrap each image behind text Windows 10 Wrap each image behind text Office 2016
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,429
gmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the rough
Default

My pleasure.
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I animate so: small image ==> large image ==> text over overlaid ==> back to next image ship69 PowerPoint 0 09-27-2019 12:55 PM
Wrap each image behind text Wrap text in text box around image with transparent background pstidsen Word 4 02-08-2016 03:30 PM
Wrap each image behind text Text wrap chuckmg@acm.org Word 6 10-01-2013 07:39 PM
Text Won't Wrap WRowan Publisher 0 06-14-2012 09:27 AM
Cells with wrap text not showing text lazylew Excel 1 08-31-2008 06:58 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:26 AM.


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