Deleting all shapes on a page...

A

ahmadka

Pretty simple question...How do I delete all shapes/connectors drawn on a
page? Something like clicking the 'New' button in Visio, except that the
resetting is done on the same page, instead of creating a new blank page ?

Please note that I don't want the pictures to be 'hidden'...I would like
them removed if possible..
 
J

JuneTheSecond

ActiveWindow.SelectAll
ActiveWindow.Selection.Delete
might delete all shapes on the current page.
 
P

Paul Herber

Pretty simple question...How do I delete all shapes/connectors drawn on a
page? Something like clicking the 'New' button in Visio, except that the
resetting is done on the same page, instead of creating a new blank page ?

Please note that I don't want the pictures to be 'hidden'...I would like
them removed if possible..

menu Edit -> Select All
Delete key
 
A

ahmadka

OK, I did it, i made a for loop at deleted all shapes individually, using the
..Delete() function :D..thanx for all your replies though...
 
P

Paul Herber

Your question didn't give any indication you wanted to do this with
software, quite the opposite in fact.
Glad you've found a solution though.
 
J

John Marshall, MVP

There is no need to loop through the shapes. The code provided by
JuneTheSecond is enough.
Sub Macro1()
ActiveWindow.SelectAll
ActiveWindow.Selection.Delete
End Sub

For future reference; An easy way to determine what code is required for an
action, is to use the Macro Recorder. The code generated may not be pretty,
but it should give you a good idea of how to proceed. The code above is the
same as JuneTheSecond's, but I obtained it by using the Macro Recorder when
I pressed CtrlA and the Delete key.

The generated code was
Application.ActiveWindow.SelectAll
Application.ActiveWindow.Selection.Delete
Removing "Application." does not affect the code.


John... Visio MVP

Need stencils or ideas? http://visio.mvps.org/3rdparty.htm
Need VBA examples? http://visio.mvps.org/VBA.htm
Visio Wishlist http://visio.mvps.org/wish_list.htm
 

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