![]() |
|
#1
|
|||
|
|||
|
I spend a lot of time cutting an image from Paint into Word and then right clicking to choose Wrap Text and then Tight. I would like to write some VBA to automate the wrapping (having first selected the "picture"). I recall doing it in 2003 but cant work it out in 2010. Not sure about the difference between InlineShape and Shape and Picture? Any help appreciated. |
|
#2
|
||||
|
||||
|
The default wrap option is in-line thus an in-line shape. To float the image you need to convert it to a shape and then set the wrap of the shape - so assuming that is the case there e.g.:
Code:
Sub Macro1()
'Graham Mayor - http://www.gmayor.com - Last updated - 16/04/2017
Dim oShape As Shape
Set oShape = Selection.InlineShapes.Item(1).ConvertToShape
With oShape.WrapFormat
.Type = wdWrapTight
.Side = wdWrapBoth
.DistanceTop = InchesToPoints(0.1)
.DistanceBottom = InchesToPoints(0.1)
.DistanceLeft = InchesToPoints(0.1)
.DistanceRight = InchesToPoints(0.1)
End With
lbl_Exit:
Exit Sub
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
|
#3
|
|||
|
|||
|
thats really helpful thanks a lot. just one thing:
there may be more than one inline object beside Item(1) present on the page. I want to Select the one I want and then run the code to wrap it. |
|
#4
|
||||
|
||||
|
Have you tried it? Item(1) is the first item in the selection. i.e. the selected image.
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
|
#5
|
|||
|
|||
|
It works a treat
v grateful for your expertise |
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| text not wrapping in Word table on Mac only | tamarix | Word Tables | 0 | 02-26-2017 12:53 PM |
Word formatting/wrapping text
|
Dracven | Word | 1 | 09-19-2016 04:52 AM |
Word inserting line breaks / wrapping text
|
Girloutside | Word | 1 | 08-10-2015 12:45 PM |
PNG logo in Word- text wrapping and diminishing image quality.
|
sscad27 | Word | 1 | 07-08-2014 03:16 AM |
| word wrapping in a text box (need help asap) | 4x4Jeep | Word | 1 | 06-21-2012 06:07 PM |