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