How to find textboxes & Floating Graphics

armsys
2StarLounger
Posts: 105
Joined: 19 Apr 2010, 10:25
Location: Hong Kong

How to find textboxes & Floating Graphics

Post by armsys »

How to find textboxes and floating graphics?
What's the wildcard search string?
Thanks in advance.
Regards,
Armstrong

User avatar
HansV
Administrator
Posts: 78492
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: How to find textboxes & Floating Graphics

Post by HansV »

You can't find floating objects using the Find, Replace or Go To dialog. These dialogs work with text and inline objects only. You *can* find text in a text box, though.

It is possible to write VBA code that loops through the Shapes collection of a document and inspects the individual shapes.

(BTW this question has been posted earlier at Find Text Box » Windows Secrets Lounge)
Best wishes,
Hans

armsys
2StarLounger
Posts: 105
Joined: 19 Apr 2010, 10:25
Location: Hong Kong

Re: How to find textboxes & Floating Graphics

Post by armsys »

Hi HansV,
Thanks for your fast reply. How to find and delete the surrounding frame of a textbox?
Armstrong
Regards,
Armstrong

User avatar
HansV
Administrator
Posts: 78492
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: How to find textboxes & Floating Graphics

Post by HansV »

Right-click the border of the text box.
Select "Format Text Box" from the popup menu.
Activate the "Colors and Lines" tab of the dialog.
Select "No Color" from the Color dropdown in the Line section.
Click OK.
x364.png
In VBA for a selected text box:

Selection.ShapeRange.Line.Visible = msoFalse
You do not have the required permissions to view the files attached to this post.
Best wishes,
Hans

armsys
2StarLounger
Posts: 105
Joined: 19 Apr 2010, 10:25
Location: Hong Kong

Re: How to find textboxes & Floating Graphics

Post by armsys »

HansV,
Thanks for your help. Perhaps your solution is the only way to automate the global deletion of textboxes.
At least, you confirm Word's Find can't delete textboxes with wildcard strings such as ^2, ^g, and/or ^d.
Thanks.
Armstrong
Regards,
Armstrong

User avatar
Goshute
3StarLounger
Posts: 397
Joined: 24 Jan 2010, 19:43
Location: Salt Lake City, Utah, USA

Re: How to find textboxes & Floating Graphics

Post by Goshute »

See also Hans and Stuarts answers to my Post=28252.
Goshute
I float in liquid gardens

armsys
2StarLounger
Posts: 105
Joined: 19 Apr 2010, 10:25
Location: Hong Kong

Re: How to find textboxes & Floating Graphics

Post by armsys »

Goshute,
Yes, we share exactly the original issue, namely frames/textboxes generated by OCR.
As for VBA Word, I'm a newie. I'll study your Post.
Thanks.
Armstrong
Regards,
Armstrong

User avatar
Goshute
3StarLounger
Posts: 397
Joined: 24 Jan 2010, 19:43
Location: Salt Lake City, Utah, USA

Re: How to find textboxes & Floating Graphics

Post by Goshute »

With a lot of help from my friends, here's the code I'm using at present:

Code: Select all

Sub FrameKiller()
' delete all frames & textboxes, keeping text
  Dim intC As Integer
  
  With ActiveDocument
    For intC = .Shapes.Count To 1 Step -1
      With .Shapes(intC)
        If .Type = msoTextBox Then .ConvertToFrame
      End With
    Next intC
    For intC = .Frames.Count To 1 Step -1
      .Frames(intC).Delete
    Next intC
  End With
End Sub
Goshute
I float in liquid gardens

armsys
2StarLounger
Posts: 105
Joined: 19 Apr 2010, 10:25
Location: Hong Kong

Re: How to find textboxes & Floating Graphics

Post by armsys »

Goshute,
Thanks a lot.
Regards,
Armstrong