- Joined
- Apr 18, 2013
- Messages
- 2
- Reaction score
- 0
Hi everyone!
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!
Ricardo
Sub InsWhiteTurn()
'
'Inserir indicador de turno das brancas
'
On Error GoTo ErrorHandler
Set sh = Shapes.AddShape(Type:=msoShapeOval, _
Left:=0, Top:=0, Width:=CentimetersToPoints(0.4), Height:=CentimetersToPoints(0.4), Anchor:=Selection.Cells(3))
With sh
.Line.Weight = 0.75
.Line.ForeColor = vbBlack
.Fill.ForeColor = vbWhite
.WrapFormat.Type = wdWrapFront
.LayoutInCell = True
.RelativeHorizontalPosition = wdRelativeHorizontalPositionColumn
.Left = CentimetersToPoints(8)
.RelativeVerticalPosition = wdRelativeVerticalPositionParagraph
.Top = CentimetersToPoints(6.15)
End With
Exit Sub
ErrorHandler:
End Sub
PS: I have open explicit determining my variables.
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!
Ricardo
Sub InsWhiteTurn()
'
'Inserir indicador de turno das brancas
'
On Error GoTo ErrorHandler
Set sh = Shapes.AddShape(Type:=msoShapeOval, _
Left:=0, Top:=0, Width:=CentimetersToPoints(0.4), Height:=CentimetersToPoints(0.4), Anchor:=Selection.Cells(3))
With sh
.Line.Weight = 0.75
.Line.ForeColor = vbBlack
.Fill.ForeColor = vbWhite
.WrapFormat.Type = wdWrapFront
.LayoutInCell = True
.RelativeHorizontalPosition = wdRelativeHorizontalPositionColumn
.Left = CentimetersToPoints(8)
.RelativeVerticalPosition = wdRelativeVerticalPositionParagraph
.Top = CentimetersToPoints(6.15)
End With
Exit Sub
ErrorHandler:
End Sub
PS: I have open explicit determining my variables.