forward and backward slide transitions .. programming different so

G

gvm

Thanks Steve, I've replaced my sound effect code with yours, yours is much
neater.

I have hit the wall because the event handler is failing even with the
autoevent.ppt and pptevent.ppt files that I downloaded from
http://skp.mvps.org/download.htm. In the case of the former, the handler
seems to work initially (I get the message that I opened a presentation) but
no macros run subsequent to new events. In the latter case, the trap-event
macro does not appear to trigger after clicking on the start button. It runs
however if I F5 the subroutine (I get the message that it is initialised) but
new events don't trigger macros subsequently.

I have checked the security settings, unloaded/reloaded the add-in all to no
avail. What am I missing that is interfering with the event handler's
operation? I noted what you said before but there doesn't appear to be any
errors occurring that would cause the traps to be disabled, and there have
been no changes to macros.

I prefer to avoid the use of the manual start and stop buttons in
PPTEvent.ppt but I don't know how to initialize the handler in an Auto_Open
subroutine in the add-in (as you suggested).

Is it possible to upload my test.ppt to you somehow?

regards
Greg
 
S

Steve Rindsberg

Thanks Steve, I've replaced my sound effect code with yours, yours is much
neater.

I have hit the wall because the event handler is failing even with the
autoevent.ppt and pptevent.ppt files that I downloaded from
http://skp.mvps.org/download.htm. In the case of the former, the handler
seems to work initially (I get the message that I opened a presentation) but
no macros run subsequent to new events. In the latter case, the trap-event
macro does not appear to trigger after clicking on the start button. It runs
however if I F5 the subroutine (I get the message that it is initialised) but
new events don't trigger macros subsequently.

Try compiling your project. Do you get any error messages?
I have checked the security settings, unloaded/reloaded the add-in all to no
avail. What am I missing that is interfering with the event handler's
operation? I noted what you said before but there doesn't appear to be any
errors occurring that would cause the traps to be disabled, and there have
been no changes to macros.

I prefer to avoid the use of the manual start and stop buttons in
PPTEvent.ppt but I don't know how to initialize the handler in an Auto_Open
subroutine in the add-in (as you suggested).

Is it possible to upload my test.ppt to you somehow?

Sure ... email to steve at-sign pptools dot com
 
G

gvm

Thanks again Steve. The event handler is working again but its instability is
a concern. The code appears to have compiled OK. Whilst the handler is
operating I have been able to test the soundeffect code and I get a runtime
error 13 "Type mismatch" on the following instruction:
With ActivePresentation.Slides(1).Shapes(oshp).AnimationSettings.
I have this statement earlier in the code:
Dim oshp As Shape

I have made sure the specified paths to the wav files are valid.
I will email, thanks so much .... Greg
 
S

Steve Rindsberg

Thanks again Steve. The event handler is working again but its instability is
a concern. The code appears to have compiled OK. Whilst the handler is
operating I have been able to test the soundeffect code and I get a runtime
error 13 "Type mismatch" on the following instruction:
With ActivePresentation.Slides(1).Shapes(oshp).AnimationSettings.
I have this statement earlier in the code:
Dim oshp As Shape

oshp is only a variable that stores a reference to the shape.
You need to assign a shape TO it.

Set oShp = ActivePresentation.Slides(1).Shapes("Bubba")

assuming you have a shape named Bubba. You'll need to name the shapes you want to
reference or use the names that PPT assigned when creating them.

The line above that gives the error needs the name of a shape in place of oshp ...
that's why it's erroring.
 
G

gvm

Steve, is there a default shape that exists on every slide that I can assign
to oshp? I prefer not to create a shape in the slide master for sake of
creating these forward and backward sound transitions if I can avoid it. I
have sent the email,
cheers ... Greg
 
S

Steve Rindsberg

Steve, is there a default shape that exists on every slide that I can assign
to oshp?

Not by default, no. But you could create one (and it can be off the slide so it doesn't
display)

I prefer not to create a shape in the slide master for sake of
creating these forward and backward sound transitions if I can avoid it. I
have sent the email,

Got it but haven't had a chance to look at it yet.
 
G

gvm

Steve, how do I create a shape that is off the slide so that it doesn't
display and then assign it to oshp? TIA ... Greg
 
G

gvm

OK Steve. The macro appears to have renamed the shape OK .... I did not get
any run errors. I pasted the shape on the first slide of the master, the
shape appears on each slide of the presentation until the time that I dragged
it off the master.

The sounds still don't play though and I don't understand why. I will
re-send you the project. regards...Greg
 
G

gvm

Steve, as per email, how should the project be modified to use
AutoEvents.ppa? This would make it easier to use sound transitions with a
wide variety of powerpoint presentations, because the manual links will not
be required on the first slide. Are there disadvantages with basing the
project on AutoEvents.ppa? TIA ... Greg
 
S

Steve Rindsberg

Steve, as per email, how should the project be modified to use
AutoEvents.ppa? This would make it easier to use sound transitions with a
wide variety of powerpoint presentations, because the manual links will not
be required on the first slide. Are there disadvantages with basing the
project on AutoEvents.ppa?

The code I modified and that was working (in a PPT file, with no add-in loaded)
had the code that actually does the work of playing sounds in the event handler
class.

AutoEvents calls certain-named routines in your PPT when events fire. You'd need
to check the docs to see what the routines need to be named and then move your
code that's currently in the event handler class of the PPT we've tossed back and
forth into a routine in your PPT, named as needed so it'll be called by AutoEvents
when the next slide event fires.
 
G

gvm

OK, I have deleted the first slide and am now relying on the Autoevents add-in.

Now, under the 6th Autoevents option, the routine that is fired is
Auto_NextSlide(Index as long).

However, the code in the macro does not relate to the index. How do I
straighten this out?

The fact the code does not relate to the index is what you have pointed out
in your comment below...

Sub Auto_NextSlide(wn As SlideShowWindow)
' Note again that the slide show window is the parameter, not slide index
' declare this as static so its value is retained between invocations of the
sub
Static LastSlide As Long
Dim CurrentSlide As Long
CurrentSlide = wn.View.Slide.SlideIndex
MsgBox "Slide No: " & CurrentSlide

But whilst you say the window is the parameter, the variable CurrentSlide is
set to the index. Can this be right?

TIA ... Greg
 
S

Steve Rindsberg

OK, I have deleted the first slide and am now relying on the Autoevents add-in.

Now, under the 6th Autoevents option, the routine that is fired is
Auto_NextSlide(Index as long).

However, the code in the macro does not relate to the index. How do I
straighten this out?

Mixing bits from several code sources doesn't always work out as you'd expect <g>.

Normally PPT passes a reference to the slideshow window to the event handler when it
fires the NextSlide event. It'd be up to you to work out what slide's about to appear.
Shyam's done that for you already and passes the slide index to your Auto_NextSlide
subroutine.

You'd want to change your sub to something like this:

Sub Auto_NextSlide(lIndex as Long)
' declare this as static so its value is retained between invocations of the
sub
Static LastSlide As Long
CurrentSlide = lIndex
MsgBox "Slide No: " & CurrentSlide

Some other adjustments might be necessary; I don't recall whether the original version
worked out the current slide or the one about to be current; Shyam's routine passes the
index of the slide about to be current (ie, the next slide).
 
G

gvm

It's not like me to quit but I have just about had enough. Thanks for your
efforts Steve. The macro still does not fire. I tried saving the project as a
pptm file but that made no difference. Autoevents is enabled. I have all
macros enabled and the 'trust access to VBA project" checkbox ticked. The
problem seems to be with the add-in. regards
Greg
 

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