How to delete a drawing shape object from all pages in one click.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a drawing shape object (Line) on each page of my document and i want
to remove all of them. I have 300 pages and deleting one by one will take ma
whole day so please tell me if there is any method to get rid of it in one
go...
I'll be very thankful to you for your quick response...

Thanks.


Engr. Abu Adal
Network Engineer
 
The macro below will remove _all_ AutoShape lines (i.e. lines created using
the Line tool in the Drawing toolbar) from the _main body_ of you document if
you make sure the insertion point is in the main body when you start the
macro (lines in e.g. the header or footer will not be removed).

Sub DeleteAllLines()

Dim oShape As Shape
Dim n As Long

n = 0
For Each oShape In ActiveDocument.Shapes
With oShape
If .Type = msoLine Then
oShape.Delete
n = n + 1
End If
End With
Next oShape

MsgBox "Finished deleting " & n & " lines."

End Sub

Before running the macro, you should save a copy of your document.

If you need help with installing macros, see:
http://www.gmayor.com/installing_macro.htm

--
Regards
Lene Fredborg
DocTools - Denmark
www.thedoctools.com
Document automation - add-ins, macros and templates for Microsoft Word
 
One alternative if this is 2003 or prior (always helpful to mention which
version of the software):

Go to Tools>Customize & on the Commands page select Drawing from the list of
categories. From the list of commands in that category add the Select
Multiple Objects command to a toolbar (FWIW, I keep it right next to the
Select Objects button on my Drawing toolbar).

HTH |:>)
Bob Jones
[MVP] Office:Mac
 
Lene and Bob have told you how to remove it if it really is anchored to
every page. But possibly it's anchored to the header (so that it repeats on
every page), so it would be worthwhile to check that out first. If it is,
you can delete it with one blow.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA

Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
Well first of all i m really very thankful to you all. I think i could not
explain you my problem. Well i have many drawing shape object like diagrams,
Lines, boxes and other stuff on almost all pages (not exactly all pages).
And i want to remove only lines not any other drawing shape object. The
drawing lines are in the main document not in any header or footer.
So please tell me the well suited way now. Hope i have described it better
now.

Waiting for your responses...

Thanx
 
The macro I provided in my previous post should do what you want. As I also
explained in that post, it removes all _lines_ (but not other types of
shapes) from the main body.

--
Regards
Lene Fredborg
DocTools - Denmark
www.thedoctools.com
Document automation - add-ins, macros and templates for Microsoft Word
 
Thanks alot Lene Fredborg. Bt as i try to run this macro, my office respond
that macro in this project are disbaled. So here is another problem that how
to enable them...

Engr. Abu Adal
Network Engineer
Ministry of IT
Govt. of Pakistan
 
This is a macro security issue. You need to change your macro security
settings to be able to run the macro. You may want to change the settings
back again when finished.

To change the macro security settings:
Select Tools > Macro > Security. On the "Security level" tab, click the
"Medium" button. On the "Trusted publishers" tab, turn on the "Trust all
installed add-ins and templates" check box. Click OK. In order for the
settings to take effect, exit Word and start Word again.

I suppose you stored the macro in your Normal.dot. It that is the case, you
should be able to open your document now and run the macro. If you stored the
macro in the document with all your lines, a warning will be shown when you
open the document, asking whether you want to disable/enable macros. Then you
must click "Enable macros" in order to be able to run the macro.

Note: it is possible to run macros with the macro security level set to High
but this requires that the macros are digitally signed.

From the Word help about macro security:
Security: Because macros can contain viruses, be careful about running them.
Take the following precautions: run up-to-date antivirus software on your
computer; set your macro security level to high; clear the Trust all
installed add-ins and templates check box; use digital signatures; maintain a
list of trusted publishers.

--
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

Back
Top