April 19th, 2013, 10:32 AM
Macro for insert oval shape in table cell (word 2007)
I'm building a macro for inserting a oval shape in the current selected cell of a table. That is: the cell isn't selected but the cursor is at the cell where I want to insert the shape.
The thing is that i want it to be placed at an exact point of that cell but the macro doesn't recognize it. It recognizes the page and places the shape in the point I determine but relatively to the page instead of the current cell.
So I have the following code. What's wrong with it?
Thanks to anyone who can help me!
On Error GoTo ErrorHandler
Set sh = ActiveDocument.Shapes.AddShape(Type:=msoShapeOval, _
Left:=0, Top:=0, Width:=CentimetersToPoints(0.4), Height:=CentimetersToPoints(0.4))
.Line.Weight = 0.75
.Line.ForeColor = vbBlack
.Fill.ForeColor = vbWhite
.WrapFormat.Type = wdWrapNone
.LayoutInCell = True
.RelativeHorizontalPosition = wdRelativeHorizontalPositionColumn
.Left = CentimetersToPoints(8)
.RelativeVerticalPosition = wdRelativeVerticalPositionParagraph
.Top = CentimetersToPoints(6.15)
PS: I'm using open explicit to determine my variables
Tags for this Thread
Click Here to Expand Forum to Full Width
This a Codeguru.com survey!