![]() |
|
![]() |
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
![]()
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 |
#2
|
|||
|
|||
![]()
Hi! Try this:
Code:
Sub Find_Str_Add_Shape() 'In the selection, find the inputboxed string & add a transparent 'blue oval shape over it. Dim rng As range Dim stri As String Dim shp As shape Set rng = selection.range stri = InputBox("Enter the string to find:") rng.Find.text = stri rng.Find.Execute If rng.Find.found Then rng.Select Set shp = ActiveDocument.Shapes.AddShape(msoShapeOval, _ selection.Information(wdHorizontalPositionRelativeToPage), _ selection.Information(wdVerticalPositionRelativeToPage), _ 20, 16) With shp .Fill.Transparency = 1 'Full transparency .Line.ForeColor.RGB = RGB(0, 0, 255) 'Blue color .Line.Visible = msoTrue End With End If End Sub |
#3
|
|||
|
|||
![]() Quote:
I apologize for my delayed response, but I've been feeling ill lately. Thankfully, I'm on the mend and am feeling about 80% better. I hope you're doing well too! I have a question that might sound a bit silly, but I was wondering if it's possible to set the width of a line? |
#4
|
|||
|
|||
![]()
Hi, syl3786! 1. You are welcome! 2. Get well as soon as possible! 3. Thank you for your wishing me good health! 4. Add
Code:
.Line.Weight = 3 Code:
.Line.ForeColor.RGB = RGB(255, 0, 0) |
#5
|
|||
|
|||
![]() Quote:
Many thanks for your help! |
#6
|
|||
|
|||
![]() ![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
yanyan9896 | Word VBA | 2 | 10-09-2023 04:59 AM |
![]() |
anand | Word VBA | 7 | 06-18-2015 10:02 PM |
![]() |
dogbite | Word | 1 | 12-17-2014 06:23 AM |
![]() |
tahakirmani | Word | 2 | 11-28-2013 05:33 PM |
![]() |
randyflycaster | Word | 5 | 09-14-2011 07:29 AM |