I'm in need of some assistance regarding Word macros. Specifically, I'm wondering if it's possible to automatically add a transparent, blue line circle shape over specific text using a Word macro. 📝💻
I've explored some options, but I'm not quite sure how to approach this task. That's why I'm reaching out to this knowledgeable community for guidance and expertise.
If you have experience with Word macros or VBA (Visual Basic for Applications), I would greatly appreciate your insights. Is it feasible to achieve this goal using a macro? Are there any specific techniques or code snippets you could suggest?
My intention is to have the macro identify the specific text within a Word document and automatically overlay a transparent, blue line circle shape on top of it (see attached document)
Expected Result.docx
Your assistance would be immensely valuable, and I'm eager to learn from your expertise. Thank you in advance for your support! 😊💙
My code drafted:
Code:
Sub AddCircleShape()
Dim rng As Range
Dim shape As Shape
Set rng = ActiveDocument.Content
rng.Find.Text = "YOUR_SPECIFIC_TEXT"
rng.Find.Execute
If rng.Find.Found Then
Set shape = ActiveDocument.Shapes.AddShape(msoShapeOval, rng.Information(wdHorizontalPositionRelativeToPage), rng.Information(wdVerticalPositionRelativeToPage), rng.Information(wdShapeSizeWidth), rng.Information(wdShapeSizeHeight))
With shape
.Fill.Transparency = 0.5 ' Adjust the transparency value as desired
.Fill.ForeColor.RGB = RGB(0, 0, 255) ' Set the color to blue; modify RGB values if needed
.Line.Visible = msoTrue
End With
End If
End Sub