object properties

I

Ivano

Hi,
I want to write a macro that will change the
width of the objects which I have selected to 540 points,
Text Wrapping to Top and Bottom
Horizontal Absolute Position 0.5" of the page
Verticle Absolute Position 2" to the top of the page
Lock Anchor
Not move with text

Thanks,
 
J

Jean-Guy Marcil

Ivano was telling us:
Ivano nous racontait que :
Hi,
I want to write a macro that will change the
width of the objects which I have selected to 540 points,
Text Wrapping to Top and Bottom
Horizontal Absolute Position 0.5" of the page
Verticle Absolute Position 2" to the top of the page
Lock Anchor
Not move with text

What type of object?
How were they selected?

Have you tries recording/editing some code?
If so, show us what you have...

--

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
I

Ivano

Sub Macro6()
'
'
ActiveDocument.Shapes("Object 178").Select
Selection.ShapeRange.Fill.Visible = msoFalse
Selection.ShapeRange.Fill.Solid
Selection.ShapeRange.Fill.Transparency = 0#
Selection.ShapeRange.Line.Weight = 0.75
Selection.ShapeRange.Line.DashStyle = msoLineSolid
Selection.ShapeRange.Line.Style = msoLineSingle
Selection.ShapeRange.Line.Transparency = 0#
Selection.ShapeRange.Line.Visible = msoFalse
Selection.ShapeRange.LockAspectRatio = msoTrue
Selection.ShapeRange.PictureFormat.Brightness = 0.5
Selection.ShapeRange.PictureFormat.Contrast = 0.5
Selection.ShapeRange.PictureFormat.ColorType = msoPictureAutomatic
Selection.ShapeRange.PictureFormat.CropLeft = 0#
Selection.ShapeRange.PictureFormat.CropRight = 0#
Selection.ShapeRange.PictureFormat.CropTop = 0#
Selection.ShapeRange.PictureFormat.CropBottom = 0#
Selection.ShapeRange.Left = 36#
Selection.ShapeRange.Top = 144#
Selection.ShapeRange.RelativeHorizontalPosition = _
wdRelativeHorizontalPositionPage
Selection.ShapeRange.RelativeVerticalPosition = _
wdRelativeVerticalPositionPage
Selection.ShapeRange.Left = InchesToPoints(0.5)
Selection.ShapeRange.Top = InchesToPoints(2)
Selection.ShapeRange.LockAnchor = True
Selection.ShapeRange.WrapFormat.AllowOverlap = True
Selection.ShapeRange.WrapFormat.Side = wdWrapBoth
Selection.ShapeRange.WrapFormat.DistanceTop = InchesToPoints(0.1)
Selection.ShapeRange.WrapFormat.DistanceBottom = InchesToPoints(0)
Selection.ShapeRange.WrapFormat.DistanceLeft = InchesToPoints(0.13)
Selection.ShapeRange.WrapFormat.DistanceRight = InchesToPoints(0.13)
Selection.ShapeRange.WrapFormat.Type = wdWrapTopBottom
End Sub
 
I

Ivano

I also should have mentioned that:
I select an area in Excel, copy, then paste special in Word as Excel
workbook link. If I were to then select the object it has black dots on the
corners and not empty round circles. All my other objects have round circles
around them. If I try to record a macro and click the object it's like i
haven't clicked anything but if i click other object it will select and
record the click (the one's with the round circles). I've redone it dozen
times with the same result... I think Word is going crazy.
 
J

Jean-Guy Marcil

Ivano was telling us:
Ivano nous racontait que :
I also should have mentioned that:
I select an area in Excel, copy, then paste special in Word as Excel
workbook link. If I were to then select the object it has black dots
on the corners and not empty round circles. All my other objects
have round circles around them. If I try to record a macro and click
the object it's like i haven't clicked anything but if i click other
object it will select and record the click (the one's with the round
circles). I've redone it dozen times with the same result... I
think Word is going crazy.

Not really..

It is because your pasted object is inline with text, which is the default
for linked object that you paste in Word. Inline shapes, as they are called
in VBA, do not have the same properties as Shape objects.

If you start the macro recorder first, and then try to click on an inline
shapes, you will not be able to do so, just as you are not able to click on
a word or a paragraph, you have to get the keyboard arrows to get there.

So, if you first select the shape, and then record a macro to modify the
inline shape size and so on, you get this recorded macro:

Selection.InlineShapes(1).Fill.Visible = msoFalse
Selection.InlineShapes(1).Fill.Solid
Selection.InlineShapes(1).Fill.Transparency = 0#
Selection.InlineShapes(1).Line.Weight = 0.75
Selection.InlineShapes(1).Line.Transparency = 0#
Selection.InlineShapes(1).Line.Visible = msoFalse
Selection.InlineShapes(1).LockAspectRatio = msoTrue
Selection.InlineShapes(1).Height = 92.15
Selection.InlineShapes(1).Width = 203.05
Selection.InlineShapes(1).PictureFormat.Brightness = 0.5
Selection.InlineShapes(1).PictureFormat.Contrast = 0.5
Selection.InlineShapes(1).PictureFormat.ColorType = msoPictureAutomatic
Selection.InlineShapes(1).PictureFormat.CropLeft = 0#
Selection.InlineShapes(1).PictureFormat.CropRight = 0#
Selection.InlineShapes(1).PictureFormat.CropTop = 0#
Selection.InlineShapes(1).PictureFormat.CropBottom = 0#

As you can see, inline shapes do not have Text Wrapping, Horizontal Absolute
Position, Vertical Absolute Position or an Anchor because they are like a
character in a line of text.
So, you could use somehting like:

Dim shpConvert As Shape
Dim lngRatio As Single

Set shpConvert = Selection.InlineShapes(1).ConvertToShape

With shpConvert
lngRatio = CSng(Format(.Width / 540, "#.00"))
.ScaleWidth lngRatio, True
.ScaleHeight lngRatio, True
.WrapFormat.Type = wdWrapTopBottom
.Top = InchesToPoints(2)
.Left = InchesToPoints(0.5)
.LockAnchor = True
End With


--

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top