Find each text box

J

Jentimus

I want a way for a user to find each text box in the main story of a
multi-section document - kind of like 'browse by object' for text boxes - so
they can see whether or not the box should be deleted.

I don't see the option for searching for shapes in find, and I don't want to
do anything with the text boxes except maybe select them if necessary.

Any suggestions would be most appreciated, but I'm not an experienced vba
writer so comments associate with the code would really help.
 
H

Helmut Weber

Hi Jentimus,
I want a way for a user to find each text box in the main story of a
multi-section document - kind of like 'browse by object' for text boxes - so
they can see whether or not the box should be deleted.

I don't see the option for searching for shapes in find, and I don't want to
do anything with the text boxes except maybe select them if necessary.

Any suggestions would be most appreciated

if so, then this might get you started:
Sub Macro5a()
Dim s As String
Dim oShp As Shape
For Each oShp In ActiveDocument.Range.ShapeRange
If oShp.Type = msoTextBox Then
oShp.Select
ActiveWindow.ScrollIntoView oShp
' otherwise you possibly won't see the shape
s = InputBox("delete y/n")
Select Case s
Case "y": oShp.Delete
Case "n": ' do nothing
Case Else: Exit Sub
End Select
End If
Next

End Sub

--

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Vista Small Business, Office XP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top