Anchor for shapes 
Author Message
 Anchor for shapes

G'day,

I seem to have misled myself about anchors.

I thought I would be able to set an anchor to place shapes in my
document, but apparently they are read-only.

If they are read-only how can they be used to place shapes using vba?
Must they be set manually?

I can locate where I wish to place a shape by the current cursor
position(selection?), which has a very wide left margin designed for a
shape to be inserted.  How can I find an anchor that correspondes to
this current position, only more to the left?

I hope this is clear, but I'm not real sure of the jargon yet.
Thanks

WK

Sent via Deja.com
http://www.*-*-*.com/



Mon, 23 Jun 2003 07:32:21 GMT  
 Anchor for shapes
Hi, Willie,

Yes, I think you have the wrong idea about anchors.

An anchor is *not* the position of the shape -- it is a Range that
represents the place in the document to which the shape is "attached". The
shape itself can be anywhere on the same page as the anchor, depending on
how you define it.

Look at the Help topic for the AddShape method, which is similar to a bunch
of others such as AddCurve. It takes six parameters, of which the last one
is Anchor:

] Anchor   Optional Variant. A Range object that represents
] the text to which the AutoShape is bound. If Anchor is
] specified, the anchor is positioned at the beginning of the
] first paragraph in the anchoring range. If this argument is
] omitted, the anchoring range is selected automatically and
] the AutoShape is positioned relative to the top and left
] edges of the page.

The second and third parameters, Left and Top, are the ones that determine
where the shape is:

] Left, Top   Required Single. The position (in points) of the
] upper-left corner of the AutoShape's bounding box,
] relative to the anchor.

Just for fun, try this. Set the document's left margin to 2 inches. Put in
this macro and run it:

Sub Goofy()
Dim myShape As Shape
Dim i As Long

' Start with a heart top-aligned with the current
' paragraph and 3 pt to its left
Set myShape = ActiveDocument.Shapes.AddShape _
    (msoShapeHeart, -75, 0, 72, 72, Selection.Range)

' Move the heart diagonally up and to the left
For i = 1 To 72
    myShape.Top = myShape.Top - 1
    myShape.Left = myShape.Left - 1
Next
End Sub

Also read the topic on the Anchor property of a Shape object to see a couple
more things you can do.

Have a good day,
Jay


Quote:
> G'day,

> I seem to have misled myself about anchors.

> I thought I would be able to set an anchor to place shapes in my
> document, but apparently they are read-only.

> If they are read-only how can they be used to place shapes using vba?
> Must they be set manually?

> I can locate where I wish to place a shape by the current cursor
> position(selection?), which has a very wide left margin designed for a
> shape to be inserted.  How can I find an anchor that correspondes to
> this current position, only more to the left?

> I hope this is clear, but I'm not real sure of the jargon yet.
> Thanks

> WK

> Sent via Deja.com
> http://www.deja.com/



Tue, 24 Jun 2003 04:02:04 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Convert Inline to Shape and Anchor Shape

2. To distinguish between floating shapes anchored at same paragraph by bookmarks

3. Changing the anchor point of a shape in code

4. Locating Anchor of a Shape

5. Shapes shapes shapes

6. new shape in another shape

7. Adding a shape from Forms Shapes Stencil

8. How to differentiate a shape created from Stencil drag/drop and shape Copy/Paste

9. How to update document master shapes from template master shapes

10. Dynamically convert shapes to Process Engineering shapes

11. Dropping shapes through VBA with shape Custom Properties setting ASK =True

12. grouping shapes and convert to inline shape

 

 
Powered by phpBB® Forum Software