no go. same error as before, can't call this from an event handler. so
here's how i have it set up:
i have 2 modules, and 1 class
the first module is called AutoRun:
Public cPPTObject As New EventClass
Sub Auto_Open()
'set an application reference to the event-enabled object
Set cPPTObject.PPTEvent = Application
End Sub
the second module is called CreateShowmod:
sub CreateShow()
a bunch of code...
end sub
sub byebye
application.quit
end sub
the class is called EventClass:
Public WithEvents PPTEvent As Application
Private Sub PPTEvent_PresentationOpen(ByVal Pres As Presentation)
CreateShow
End Sub
it just really doesn't want me to call application.quit from an event
handler. if only afterpresentationopen would fire every time, even if PP
wasn't fully closed...
i'm trying to figure out some other ways around this as well, seeing if it
will let me call application.quit from a different event. this is so
frustrating.
thanks
scott
"Steve Rindsberg" wrote:
> I'm not clear on what you put where ...
>
> I'm thinking you need an addin project with at least one regular basic module and
> one class.
>
> The bas module contains your CreateShow code and the "byebye" sub, plus whatever
> other code you need.
>
> The class contains just the event handler code. The PresentationOpen event should
> call your CreateShow code and the end show event should call ByeBye.
>
> See how that works ...
>
> In article <38E7143E-4C50-41DA-92B1-(E-Mail Removed)>, Theintern wrote:
> > I tried the following as well. Same error message as other strategy.
> >
> > Public WithEvents PPTEvent As Application
> >
> > Private Sub PPTEvent_PresentationOpen(ByVal Pres As Presentation)
> > CreateShow
> > ByeBye
> > End Sub
> >
> > Public Sub ByeBye()
> > Application.Quit
> > End Sub
> >
> > "Steve Rindsberg" wrote:
> >
> > > In article <F5474780-45D8-4143-AC02-(E-Mail Removed)>, Theintern
> > > wrote:
> > > > I'd like to close PowerPoint from an event handler, but it gives me an error
> > > > when i try to do so. Right now i have it set up so that when PP is open a
> > > > macro runs the show for a set amount of time. At the end of that, the show
> > > > is closed (ActivePresentation.close) and then i'd like PP to close as well
> > > > (Application.quit) but apparently this code can't be run off an event. Any
> > > > ideas?
> > >
> > > What's the exact error message you get.
> > >
> > > And have you tried firing a sub in your addin from within the event handler
> > > class:
> > >
> > > ByeBye
> > >
> > > Public Sub ByeBye()
> > > Application.Quit
> > > End Sub
> > >
> > > -----------------------------------------
> > > Steve Rindsberg, PPT MVP
> > > PPT FAQ: www.pptfaq.com
> > > PPTools: www.pptools.com
> > > ================================================
> > >
> > >
> > >
> >
>
> -----------------------------------------
> Steve Rindsberg, PPT MVP
> PPT FAQ: www.pptfaq.com
> PPTools: www.pptools.com
> ================================================
>
>
>