View Single Post
 
Old 03-12-2022, 07:51 AM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2019
Expert
 
Join Date: Aug 2014
Posts: 4,144
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

Try the following
Code:
Sub Macro1()
Dim oShape As Shape
Dim TestValue As String
    TestValue = "test"
    For Each oShape In ActiveDocument.Shapes
        If InStr(1, oShape.TextFrame.TextRange, TestValue) > 0 Then
            'do something with the shape e.g.
            MsgBox oShape.TextFrame.TextRange
        End If
    Next oShape
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote