Macro to search for graphics

J

Johann Swart

Some time ago someone provided me with a macro to search for graphics that
were created by using any of the tools on Word's Drawing toolbar, i.e. lines,
text boxes, etc.
Unfortunately, when I was given a new PC, my macros and customisation were
not carried over.
Is there anyone out there that has such a macro and is willing to share it?
 
L

Lene Fredborg

You do not explain exactly what you expect the macro to do.

Graphics can be in the _text_ layer (wrapping style “In line with textâ€) or
in the _drawing_ layer (any other wrapping style) of a document.

You can search for graphics in the text layer via the normal Find function
(type ^g in the search field or click the More button and select Special >
Graphic).

It’s my guess that you want a macro that can find graphics in the drawing
layer. If this is the case, I think that the macro found via the link below
is what you are looking for:
http://wordtips.vitalnews.com/Pages/T1447_Searching_for_Floating_Graphics.html

--
Regards
Lene Fredborg
DocTools – Denmark
www.thedoctools.com
Document automation – add-ins, macros and templates for Microsoft Word
 
J

Johann Swart

Hi Lene,
Thanks for the response.
I was in fact looking for the second option, i.e. graphics in the drawings
layer, and the hyperlink you provided is the Real McCoy. I have installed it
and it works splendidly.
I work with documents where other compilers sometimes insert text boxes
without background or border colours, in other words, they become invisible
if they also do not contain any text. This macro is mainly used for searching
such text boxes.
Thanks a million!
 
C

CyberTaz

I'm glad the macro is just what the Dr. ordered, but just one other little
tip - If you turn on the non-printing characters (¶) you'll see the markers
in the otherwise-empty text boxes. Depending on the text wrap applied they
either mark & account for inappropriate white space or appear in places
where they normally 'shouldn't'... That makes such things easier to spot.

HTH |:>)
Bob Jones
[MVP] Office:Mac
 
J

Johann Swart

Hi Bob,
Yes, you're hundred percent correct; it's just so much easier--and
quicker--having to wade through hundreds of pages looking for an empty 10x5
millimetre (½"x¼") text box (with a 6pt paragraph marker) that could or could
not be there.
Thanks for your response Bob; it's highly appreciated!
Regards
Johann Swart
 
L

Lene Fredborg

As far as I understand now, you are actually only interested in finding
_empty textboxes_ and delete them. This can be done much easier. The macro
below finds all shapes in the drawing layer of the active document. If a
shape is a textbox and if that textbox contains nothing but a paragraph mark,
the textbox is automatically deleted. When finished, a message tells you how
many textboxes have been deleted.


Sub DeleteEmptyTextBoxes()

Dim oShape As Shape
Dim nCount As Long

nCount = 0
For Each oShape In ActiveDocument.Shapes
If oShape.Type = msoTextBox Then
'If textbox contains only a paragraph mark, delete it
If Len(oShape.TextFrame.TextRange) = 1 Then
oShape.Delete
nCount = nCount + 1
End If
End If
Next oShape

MsgBox nCount & " empty textbox(es) deleted."

End Sub

--
Regards
Lene Fredborg
DocTools – Denmark
www.thedoctools.com
Document automation – add-ins, macros and templates for Microsoft Word
 

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