Deleting all shapes from a visio page programmatically

A

ahmadka

Can someone please tell me how to delete all the shapes off from a visio page
programmatically ?

Thanks in advance.
 
J

JuneTheSecond

Program is simple, but I recommend you to study about Visio through the
references presented in MSDN online,
( http://msdn2.microsoft.com/en-us/library/aa245244(office.10).aspx ),
help in Visio application, or Visio sdk.
Othewise, you have to waste your time for questioning line by line.
Dim shp As Visio.Shape
Dim I As Long, N As Long
N = ActivePage.Shapes.Count
For I = N To 1 Step -1
ActivePage.Shapes(I).Delete
Next
 
P

Paul Herber

Program is simple, but I recommend you to study about Visio through the
references presented in MSDN online,
( http://msdn2.microsoft.com/en-us/library/aa245244(office.10).aspx ),
help in Visio application, or Visio sdk.
Othewise, you have to waste your time for questioning line by line.
Dim shp As Visio.Shape
Dim I As Long, N As Long
N = ActivePage.Shapes.Count
For I = N To 1 Step -1
ActivePage.Shapes(I).Delete
Next

But watch for shapes with delete protection set, reset the delete
protection before doing the delete.
 

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