Help with deleting all shapes on a Page!

T

TRV

I am trying to clear a page with code which works fine if there are shapes on
the page that are selected. However the way I am doing this I am opening a
file and clearing a page that may have nothing on it. If I do this I get an
error.
How can I check or count if there are any shapes on a page?

Help please
 
P

Paul Herber

I am trying to clear a page with code which works fine if there are shapes on
the page that are selected. However the way I am doing this I am opening a
file and clearing a page that may have nothing on it. If I do this I get an
error.
How can I check or count if there are any shapes on a page?

Trick: as you delete shapes one by one the page shapes counter goes
down so counting from 1 to page.shapes.count can fail.

try
if page.shapes.count > 0 then
for counter = page.shapes.count downto 1
blah

for whatever language you use.
 
T

TRV

Thanks worked exactly like I wanted.
--
TRV


Paul Herber said:
Trick: as you delete shapes one by one the page shapes counter goes
down so counting from 1 to page.shapes.count can fail.

try
if page.shapes.count > 0 then
for counter = page.shapes.count downto 1
blah

for whatever language you use.
 

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