I'm working on developing a word macro that adds a circle shape over specific text. I've already created the macro, but I'm experiencing some issues with the accuracy of the circle shape placement.
Code: Select all
Sub ACS()
Dim rng As Range
Dim stri As String
Dim shp As Shape
Set rng = ActiveDocument.Range
stri = "ABCD/"
With rng.Find
.Text = stri
.Execute
While .found
rng.Select
Set shp = ActiveDocument.Shapes.AddShape(msoShapeOval, _
Selection.Information(wdHorizontalPositionRelativeToPage), _
Selection.Information(wdVerticalPositionRelativeToPage), _
65, 25)
With shp
.Fill.Transparency = 1 'Full transparency
.Line.ForeColor.RGB = RGB(255, 0, 0)
.Line.Weight = 1
.Line.Visible = msoTrue
End With
rng.Collapse wdCollapseEnd
.Execute
Wend
End With
End Sub
If any of you could offer any assistance on how to improve the accuracy of the macro, it would be greatly appreciated!