VBA - remove unused masters?

  • Thread starter Thread starter Mel
  • Start date Start date
M

Mel

I'm using PPT 2003 and wanting to remove unused slide/title masters
from my presentations in an automated way. I may have a lot of masters
in a presentation and I have to do this frequently to shave off a few
megs. I thought PPT had a command to do that, but I can't find it. Is
there a way to do this with VBA?

Thanks,
Melina
 
You need to reset bDesInUse and you can check for the design directly too
instead of comparing their names. Here is the modified code:

Sub DelUnusedDesigns()
Dim x As Long
Dim oDes As Design
Dim oSld As Slide
Dim bDesInUse As Boolean

With ActivePresentation
For x = .Designs.Count To 1 Step -1
Set oDes = .Designs(x)
bDesInUse = False
For Each oSld In ActivePresentation.Slides
If oSld.Design Is oDes Then
bDesInUse = True
Exit For
End If
Next
If Not bDesInUse Then
oDes.Delete
End If
Next
End With
End Sub

- Chirag

PowerShow - View multiple PowerPoint slide shows simultaneously
http://officeone.mvps.org/powershow/powershow.html
 
Fate has its funny ways! <lol> Actually, I needed both your ways of
doing this. I can check the designs in simpler instances, but will
need to check for like strings in the master names when opened in 2007
then transferred back to 2003 because of the hosing of the masters
going back and forth creates. It's complicated. <sigh>

Thanks to both of you!

Melina
 
Back
Top