Re: forward and backward slide transitions .. programming differen
- From: gvm <gvm@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sun, 3 Aug 2008 04:07:00 -0700
Steve,
re your question "is test.ppt the file where your macros are stored?", the
answer is I think so; - the macro is visible when I view the source code in
VBAProject(test.ppt)/Modules/Module 1.
Re your point about having to reset the event handler: I disabled and
re-enabled Auto Events inside ppt. Is that the way to reset the event trap?
Doing so appears to have failed to make any difference - tne event handler /
macro still doesn't fire.
kind regards ... Greg
"Steve Rindsberg" wrote:
In article <B4EB0A94-3A1E-4EE7-AA87-81BE5EE0FC68@xxxxxxxxxxxxx>, Gvm wrote:.
Thanks Steve.
I updated the macro code you provided me in
VBAProject(test.ppt)/Modules/Module 1 and created and pasted the Private Sub
PPTEvent subroutine in VBAProject(test.ppt)/Class Modules/Class 1.
AutoEvents is enabled within ppt but the event and/or macro is not firing.
Have I interpreted your instructions correctly?
Possibly, but remember that within a PPT, every time you edit the macro or get an error
message, it's likely going to disable event trapping, so you have to re-set the event
trap.
I noticed that if I select Tools/Macro/Macros from test.ppt, no macros are
listed as being present in test.ppt. Is this expected, or is it an indication
of why I have a problem?
Not sure ... is test.ppt the file where your macros are stored?
Thanks again Steve, I appreciate your patience with me ... Greg
"Steve Rindsberg" wrote:
Give this a try instead:
First, you need to add this to the event class if it's not already there:
Private Sub PPTEvent_SlideShowNextSlide(ByVal wn As SlideShowWindow)
Call Auto_NextSlide(wn)
End Sub
Note that the parameter passed to the event is the slide show window, not the slide
index; in your code module, this:
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
If LastSlide = 0 Then
' we just started the show
' add special case code here or ignore
'
' we'll ignore:
LastSlide = CurrentSlide
Exit Sub
End If
If CurrentSlide > LastSlide Then
' we moved forward
ActivePresentation.Slides(1).SlideShowTransition.SoundEffect _
.ImportFromFile "c:\program files\microsoft office\media\laser.wav"
Else
' we moved backward
ActivePresentation.Slides(1).SlideShowTransition.SoundEffect _
.ImportFromFile "c:\program files\microsoft office\media\type.wav"
End If
LastSlide = CurrentSlide
End Sub
In article <C81958A0-8E8A-4042-B1EC-A5E27FEEA340@xxxxxxxxxxxxx>, Gvm wrote:
Steve,
I have based my macro on Shyam Pillai's sub that reports the index number in
a message box after each slide transition. Use of the sub shows that the
variable "index" reports the correct slide number transitioning both forwards
and backwards. Since Nextslide runs before moving to the next slide and I
read that "SlideIndex" is the index of the next slide, I thought the test for
whether transition is forward or back is simply a comparison of Shyam's
"index" and "SlideIndex".
So what follows is my adaptation of Shyam's macro. I expect there are a
number of problems in it, but the first is that the sub loops on the first
slide, ie the message box pos up repeatedly and it is necessary to terminate
ppt to get out of the loop. I would appreciate your help, TIA .. Greg
Sub Auto_NextSlide(Index As Long)
Dim CurrentSlide As Long
CurrentSlide = Index
MsgBox "Slide No:" & Index
If ActivePresentation.SlideShowWindow.View.Slide.SlideIndex >
CurrentSlide Then
' we moved forward
ActivePresentation.Slides(1).SlideShowTransition.SoundEffect _
.ImportFromFile "c:\program files\microsoft office\media\laser.wav"
Else
' we moved backward
ActivePresentation.Slides(1).SlideShowTransition.SoundEffect _
.ImportFromFile "c:\program files\microsoft office\media\type.wav"
End If
End Sub
"Steve Rindsberg" wrote:
In article <E61EF0BD-0770-4862-BF80-74A17376425A@xxxxxxxxxxxxx>, Gvm wrote:
I have a certain sound play each time the ppt slide show transitions forwards
from one slide to the following one. The same sound plays when I transition
in reverse, ie from one slide to the previous slide. Using standard
functions, is it possible to set different sounds when transitioning forward
and in reverse?
No, afraid not.
If not, can a macro be written that runs each time there is a slide
transition, detects whether the transition is forward or backward, and
depending on the direction plays either one of two sounds?
Probably so. You'd need to implement an event handler in an add-in:
Make PPT respond to events
http://www.pptfaq.com/FAQ00004.htm
It could trap slide changes and by storing the previous slide's Index in a
global or static variable, compare that with the current slide to work out if
you're moving forward or backward.
I'm not sure exactly when the event fires though ... on or after slide change.
That might make a difference.
--
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
================================================
--
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================
- Follow-Ups:
- Re: forward and backward slide transitions .. programming differen
- From: Steve Rindsberg
- Re: forward and backward slide transitions .. programming differen
- References:
- Re: forward and backward slide transitions .. programming differen
- From: Steve Rindsberg
- Re: forward and backward slide transitions .. programming differen
- From: gvm
- Re: forward and backward slide transitions .. programming differen
- From: Steve Rindsberg
- Re: forward and backward slide transitions .. programming differen
- Prev by Date: Re: forward and backward slide transitions .. programming differen
- Next by Date: Re: methods of object "Internet Explorer"
- Previous by thread: Re: forward and backward slide transitions .. programming differen
- Next by thread: Re: forward and backward slide transitions .. programming differen
- Index(es):
Relevant Pages
|
Loading