pwerpoint presentation duration

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want VB or VBA to be able to tell when it opens a presentation what the
duration of that presentation is (i.e. the total slide transition time for
each slide). Does anyone know how to do this

Thanks

Michael Bond
 
The following code will tell you total transition time for each slide,
but this ignores automatic animations within each slide:

Sub TranTime()
Dim totalTranTime
Dim sld As Slide

totalTranTime = 0
For Each sld In ActivePresentation.Slides
totalTranTime = totalTranTime + _
sld.SlideShowTransition.AdvanceTime
Next sld

MsgBox "The total transition time for slides will be " & _
totalTranTime & " seconds."
End Sub


--
David M. Marcovitz
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.loyola.edu/education/PowerfulPowerPoint/
 
Good one! But you might want to modify it like so:

David M. said:
The following code will tell you total transition time for each slide,
but this ignores automatic animations within each slide:

Sub TranTime()
Dim totalTranTime
Dim sld As Slide

totalTranTime = 0
For Each sld In ActivePresentation.Slides
' Check to see if the slide's hidden; don't add it's time if so
If Not sld.SlideShowTransition.Hidden Then
totalTranTime = totalTranTime + _
sld.SlideShowTransition.AdvanceTime

End if
 
Steve

Thanks for that addition ..... I didn't specify in my posting the reason for
my requirement so you have no idea how useful that little addition is. My
application finds every presentation in a particular directory and runs the
slide show on each presentation in turn. The presentation PC is linked to a
TV screen(s) in the main areas where employees work. Thus any team leaders,
managers, HR peaople etc can quickly get info displayed to employees by
simply writing and saving a powerpoint presentation of their own design to
that directory. My application needs to know the duration of the slide show
so it can go to sleep for that period before closing the show and opening the
next one..... and yes, you were right, I hadn't thought of the possibility of
hidden slides in the presentation.

Thanks very much to both of you for your help with this. I've always
appreciated the expertise found through these discussion groups.

Regards

Michael Bond
 
Steve

Thanks for that addition ..... I didn't specify in my posting the reason for
my requirement so you have no idea how useful that little addition is.

Thanks for saying so ... and I'm glad I could help. Sounds like a neat
application you've got there, too.
 
Steve

It's rough around the edges (result of an amatuer designer...I am entirley
self taught when it comes to coding) but, importantly, it does eactly what I
need it to do....and even more importanlty what my bosses want it to do. I'll
spend some time over the next few weeks polishing it up and getting rid of
the "jittery" bits...but, as I say, it works. I ended up translating the code
into VB.NET2003 (cos that's the way our Tech Support want to go). If you
think it is of any use to you, or any of the folks with whom you have
contact, let me know and I'll gladly send you a text copy of the code

Regards

Michael Bond
Planning and Information Manager
RNID Typetalk, the UK's National Telephone Relay Service for the Deaf
 
Thanks for catching that. I bet there are few more possibilities we can
think of. For example, what if the slide show is set to play only slides
5 to 10? I'm glad I don't do coding for a living. I would hate to have
to think of every possible way my code could mess up.
--david

--
David M. Marcovitz
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.loyola.edu/education/PowerfulPowerPoint/
 
David M. said:
Thanks for catching that. I bet there are few more possibilities we can
think of. For example, what if the slide show is set to play only slides
5 to 10? I'm glad I don't do coding for a living. I would hate to have
to think of every possible way my code could mess up.

It's a given that you *can't* think of every possible way to mess your code up.
That's what users and Microsoft are for. ;-)

That's one I hadn't thought of either. Michael, if you're still watching:

Dim lStart, lEnd as Long, lAdvanceMode

With ActivePresentation.SlideShowSettings
lStart = .StartingSlide
lEnd = .EndingSlide
lAdvanceMode = .AdvanceMode
End With

Then instead of iterating through the entire slides collection, go from lStart
to lEnd

But first,

if lAdvanceMode <> ppSlideShowUseSlideTimings Then
' ppSlideShowUseSlideTimings is a constant = 2 by the by
' BUG OUT, the show won't advance
' Or change the setting yourself so it DOES,
' then assign arbitrary timings to all slides
' since the user didn't bother to
End if
 
Very generous, Michael. So long as it's ok with your management, I'd like to see a
text copy of the code. Email to steve at-sign-thingie pptools dot com would be
fine.

Thanks!
 
Steve and David

I've actually got a better solution for the ways this can be messed up
....... my users (i.e. the designers of the presentations) don't actually know
enough about PowerPoint to be able to set slide shows to run specific slides
(well not yet anyway!!)

Thanks both

Michael
 
Steve and David

I've actually got a better solution for the ways this can be messed up
....... my users (i.e. the designers of the presentations) don't actually know
enough about PowerPoint to be able to set slide shows to run specific slides
(well not yet anyway!!)

Key point. Not Yet. Just you wait, 'Enry 'Iggins.
 
Thanks guys. I am trying to cut 5 minutes off a presentation and without
this you can't imagine how hard that is to do!
 
Back
Top