I am working on an application that is going to leverage excel to dynamically populate and create a slide deck.

I have everything completed, however there is one component that i can use help with.

The final step of PPT generation is deleting hidden slides. Build a macro within PPT that is launched by the Excel Macro to delete the slides (everything works), however this requires Macros to be enabled within the PPT file. Because the PPT file is a hidden file and runs in the background (and the skill level of the users it not great) I am trying to get around this limitation.

I cannot figure out how to get the VB code in excel to remove the need to enable macros in the powerpoint file.

Here is the macro in powerpoint


Sub DeleteHidden()

Dim x As Long
For x = ActivePresentation.Slides.Count To 1 Step -1
With ActivePresentation.Slides(x)
If .SlideShowTransition.Hidden = True Then
.Delete
End If
End With
Next

End Sub


I am launching it from the Excel macro with this.

oPPTApp.VBE.ActiveVBProject.VBComponents.Item("Module1").Activate
oPPTApp.AddIns.Application.Run ("DeleteHidden"), ""


.....

Thanks in advance!