vba - Powerpoint Event handling - Prevent New Presentation -
i creating powerpoint add-in. restrict user either:
- create new presentation
- open existing presentation
i have used this tutorial/overview trap newpresentation
, presentationopen
events. close presentation initialized through these events before user can interact it. when try close using .close
method, receive error (screenshot below).
in class module, have following trap newpresentation
event. works fine, receive message box , pres
valid presentation object can passed closenewpres
routine.
private sub pptevent_newpresentation(byval pres presentation) msgbox "you cannot use charting tool multiple presentations.", vbinformation closenewpres pres end sub
in standard module, have closenewpres
routine, expect close "new" presentation:
sub closenewpres(pres presentation) application.presentations(pres.name).close 'pres.close '<~~ fails.' end sub
i receive following error.
any thoughts on why happening? or can close these presentations?
in opinion need use event quite similar 1 used:
private sub ppapp_afternewpresentation(byval pres presentation)
if set pres.close
within proposed 1 closes new created presentation.
Comments
Post a Comment