View Single Post
 
Old 01-19-2024, 07:58 AM
syl3786 syl3786 is offline Windows 10 Office 2019
Advanced Beginner
 
Join Date: Jan 2023
Posts: 97
syl3786 is on a distinguished road
Default

Quote:
Originally Posted by vivka View Post
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
You may change 'Set rng = selection.range' to 'Set rng = ActiveDocument.range'.
Hi Vivka, thank you so much for your assistance - it really helped me!

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?
Reply With Quote