Share via

delete "empty" objects from slide

Anonymous
2012-09-11T13:12:37+00:00

Hi

I would like to cleanup slides using VBA

I browse on all Slide objects and try to find :

empty Textbox

empty PlaceHolder

empty Textbox are those with  Trim(ActivePresentation.Slides(Slide_No).Shapes(i).TextFrame.TextRange) = ""

but to find "empty" Placeholder looks more tricky.

I found out that when a picture was 'pasted' into the slide - it is a Placeholder - not a picture.

How can I identify real empty Placeholder that can be deleted safely ?

Thank you !!!

Microsoft 365 and Office | PowerPoint | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Steve Rindsberg 99,161 Reputation points MVP Volunteer Moderator
2012-09-11T15:59:26+00:00

You can also look at each shape on the slide and test like so:

If oSh.HasTextFrame Then

If oSh.TextFrame.HasText Then

' it's not empty

Else

oSh.Delete

End If ' hastext

End If ' HasTextFrame

By the way, pasted pictures don't always become placeholders, but yes, sometimes they do.

If the shape's .Type property = 14, it's a placeholder.

You can check the placeholder's .PlaceholderFormat.ContainedType property to find out what the placeholder contains and depending on the results, check for text or if it's a picture or chart, leave it alone.

Was this answer helpful?

0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Anonymous
    2012-09-12T13:03:08+00:00

    perfect !!!   thank you !!!

    Was this answer helpful?

    0 comments No comments