Delete all wordart?

S

Steve

Hi

has anyone got some vba code to delete all wordart from a doc? I've
hunted down some that deletes all text boxes, buit can't find any that
does wordart

TIA

Steve
 
G

Graham Mayor

Word art insertions are merely graphics. They can be handled like any other
graphics. Are the inserted in line or floating? Are they in the document
body, or header? Are there other graphics present? It may be sufficient for
your purposes to replace ^g with nothing.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
S

Steve

Hi Graham

The wordart is in the body of the doc and is floating. And there are
lots of other graphics in the doc.

I tried replace ^g with nothing and word replaced every graphic EXCEPT
the wordart!?!

Any other ideas, or shall I start doing it manually? :eek:(

Steve
 
S

Steve

In addition, it definitely IS wordart, as soon as I click on it the
wordart toolbar appears.

Oh, and it's Word 2002.

Steve
 
H

Helmut Weber

Hi Steve

for shapes:


Dim oShpNrm As Shape ' normal shape
For Each oShpNrm In ActiveDocument.Shapes
If oShpNrm.Type = msoTextEffect Then
' oShpNrm.Select
' MsgBox "WordArt Shape"
oShpNrm.delete
End If
Next
 
K

Klaus Linke

Helmut, Steve,

I've enhanced the code a bit, so it works for both inline and non-inline
WordArt ...
Also, the method to determine whether it's WordArt is changed, though I'm
not sure my method is fool-proof either.
And the text of the WordArt is kept -- If you don't wnat that, remove the
two "Selection.Text = sText" lines

Dim oShpNrm As Shape
Dim oInlineShpNrm As InlineShape
Dim sText as String
On Error GoTo ErrHandler
For Each oShpNrm In ActiveDocument.Shapes
sText = "no Word Art"
sText = oShpNrm.TextEffect.Text
If sText <> "no Word Art" Then
oShpNrm.Select
Selection.Text = sText
End If
Next
For Each oInlineShpNrm In ActiveDocument.InlineShapes
sText = "no Word Art"
sText = oInlineShpNrm.TextEffect.Text
If sText <> "no Word Art" Then
oInlineShpNrm.Select
Selection.Text = sText
End If
Next
ErrHandler:
Err.Clear
Resume Next
 

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