I need export and close powerpoint

  • Thread starter Evandro Contato
  • Start date
E

Evandro Contato

Hello everyone,

I need open export and close powerpoint, for this I developed and installed the following macro to add in.

Option Explicit

Public WithEvents PPTEvent As Application

Private Sub PPTEvent_AfterPresentationOpen(ByVal Pres As Presentation)
ShowPPT
End Sub


Sub ShowPPT()
ActivePresentation.ExportAsFixedFormat ActivePresentation.Path & "\" & ActivePresentation.Name & ".pdf", ppFixedFormatTypePDF
ActivePresentation.Close
Application.Quit 'this does not work
End Sub

Ok, open and the export ok, but the closing does not work, gives error event handler.

Error: Application (unknown member): Invalid Request. This operation cannot be performed in this event handler.

I tried to put a timer to close the application after 1 second but did not work.

Any idea how to solve?

Thank you,

Evandro
 

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