a macro that makes a slide replay even if its been viewed already.

C

cherylhyams

is there a macro I can write that will make slides replay even if they
have already been viewed? Cheers
 
D

David M. Marcovitz

(e-mail address removed) wrote in @p15g2000hsd.googlegroups.com:
is there a macro I can write that will make slides replay even if they
have already been viewed? Cheers

ActivePresentation.SlideShowWindow.View.GotoSlide 1, msoTrue

will go to the first slide and reset it. Change the 1 to something else to
go to a different slide. Is this what you want? Note that you can do this
without VBA by putting a blank slide before the slide that needs resetting,
setting the blank slide to advance after 0 seconds, and making links to the
blank slide instead of the slide with animation.

--David

--
David M. Marcovitz
Microsoft PowerPoint MVP
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/
 
C

cherylhyams

Thankyou, im new to vba, can you eplain exactly what i do?

I have tried the other option with the blank slides and this works
great on a pc but it is failing to work properly on a mac
(occasionally the presentation just sits on the blank slide and doesnt
move off even though it is set to 0 seconds.)

So if i am in powerpoint and i want to write the macro code... how do
i begin?
will this code make any slide i decide to navigate to replay even if i
have already viewed it?

Thanks
 
D

David M. Marcovitz

First place to start is here:

How do I use VBA code in PowerPoint?
http://www.pptfaq.com/FAQ00033.htm

The code I provided is not going to reset every slide every time you go
to it. It bascially replaces the hyperlink to slide 1. To do something
that impacts every slide change is going to be way too complicated for
you and would require creating an add-in that traps slide change events.

You can create a series of procedures in the form:

Sub GotoAndResetSlide1 ()
ActivePresentation.SlideShowWindow.View.GotoSlide 1, msoTrue
End Sub

Sub GotoAndResteSlide2 ()
ActivePresentation.SlideShowWindow.View.GotoSlide 2, msoTrue
End Sub

etc.

Every time you want to link to the first slide, you would create your
button or hypertext and set the action settings to run the first macro
instead of inserting a regular hyperlink. The same for linking to the
second slide and the second macro, etc.

This is the best I'm going to be able to do in a brief newsgroup answer.
If this is not helpful enough, you might want to spend some time perusing
the Programming PowerPoint section of the PPT FAQ
(http://pptfaq.com/index.html#name_PROGRAMMING_POWERPOINT).

--David
--
David M. Marcovitz
Microsoft PowerPoint MVP
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/

(e-mail address removed) wrote in @y66g2000hsf.googlegroups.com:
 
C

cherylhyams

Thanks for your help and suggestions. My presentation is massive (i
have over a 1000 slides) and it would be an endless job to write a
macro for every slide and then reset every back button but thankyou
any way.
 
D

David M. Marcovitz

Do all the Back buttons link to specific slides? If so, this job might not
be as massive as you think. You could probably write a macro to do a lot of
the work for you. If they are just links to "Last Slide Viewed" then it
would be harder because you would need a way to get the macro to know where
to link. No, I take that back. You can get the slide number of the last
slide viewed quite easily, so that shouldn't even be a roadblock.

This is possible. The biggest roadblock for you will be learning enough VBA
to make it work.

--David

--
David M. Marcovitz
Microsoft PowerPoint MVP
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/

(e-mail address removed) wrote in @n59g2000hsh.googlegroups.com:
 
C

cherylhyams

Each back button takes you back previous slide in the presentation,
not necessarily the last slide viewed. for example if you are on slide
8, the back button should take you to slide 7, and then if you are on
slide 7, the back button will take you to slide 6. If, however, you
were at the main menu and you linked to slide 8 and then pressed back
it would still take you to slide 7 (rather than back to the main
menu). However if it is easier to just go back to last slide viewed
then that would still be ok.

basically i need script that says: go to previous slide and reset.

if i can get script to this effect i can write it once, assign the
code to the back button, put the back button in the master slide and
the back button would automatically be on everyslide and take you
back.

do you think this is possible? maybe the code would have to be: goto
present slide -1, mso true????

where do i find out more about vba and how to write the exact code
that i need?
 
C

cherylhyams

i found this on a vba website, it apparently re sets the animation for
the current slide during the slide show

Code to reset animation build for the current slide during the slide
show:

Sub ResetSlideBuilds()
Dim lSlideIndex As Long
lSlideIndex = SlideShowWindows(1).View.CurrentShowPosition
SlideShowWindows(1).View.GotoSlide lSlideIndex, True
End Sub

do you think this would work? would this then automatically reset all
the animation so that next time you viewed the slide it would play?
snd would this have to be assigned to a button (meaning the viewer
would have to click a button to reset the animation) or would it just
happen automatically??
 
D

David M. Marcovitz

That's even easier:

Sub BackAndReset()
ActivePresentation.SlideShowWindow.View.GotoSlide _
ActivePresentation.SlideShowWindow.View.Slide.SlideIndex - 1, _
msoTrue
End Sub

The only minor difficulty is that it doesn't really work on the first
slide, but you can just cover up the back button on the first slide (or
use a title master).

--David
--
David M. Marcovitz
Microsoft PowerPoint MVP
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/

(e-mail address removed) wrote in @o5g2000hsb.googlegroups.com:
 
D

David M. Marcovitz

This does the same thing as my code so it should work if you make one
modification. This takes you tot he current slide and resets the current
slide. You want to go back one slide. You will need to add -1 (that's a
minus sign followed by the number 1 right after lSlideIndex (before ,
True).
--David

--
David M. Marcovitz
Microsoft PowerPoint MVP
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/

(e-mail address removed) wrote in @n59g2000hsh.googlegroups.com:
 
C

cherylhyams

thats fantastic... however i just tried it and it didnt work. i put
the code that you wrote onto the back button and just put the back
button on the master slide but when i viewed the slide the button
didnt go back. is this becasue its in the master slide or should it
still work even if its in the master?
 
D

David M. Marcovitz

Just to be sure that this wasn't a Mac issue, I did it on my Mac, and it
worked just fine. In my Mac version of PowerPoint, there is a preference
(under General) to Enable macro virus protection. However, I believe this
just asks if you want to run macros when macros are present, so you
should have said "yes."

I assume you know that the actions only happen in Slide Show View.

Also, this procedure does not work when you click the button on the first
slide (because it can't go back to the 0th slide), but it should work on
every other slide.

Check for extra line breaks caused by the news system. The code I posted
had 5 lines. The first ends with (); the second and third end with
underscores, the fourth ended with msoTrue, and the fifth just had End
Sub.

You might try going into the VBA Editor and going to the Debug menu and
choosing Compile to see if it comes up with any errors.

Have you successfully run any macros? Try something simple like:

Sub HelloWorld()
MsgBox "Hello, World"
End Sub

Unfortunately, I can't look over your shoulder to see what you are doing
wrong, but the code works. I have tested it on Macs and PCs with a button
on a regular slide and on a master slide.

--David

--
David M. Marcovitz
Microsoft PowerPoint MVP
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/

(e-mail address removed) wrote in @l77g2000hsb.googlegroups.com:
 
C

cherylhyams

hey,

i've tried the scripting on both the master and a regular slide and
the button doesn't seem to go back... i will try debugging. I managed
to use the script you gave me initially and that all works fine but
for some reason this new script doesn't seem to do anything. I will
keep trying. Thanks for all your help :)
 
C

cherylhyams

I opened up a different presentation and tried the script again and it
works!
it must have been something I was doing wrong before... the back
button works perfectly now!
thankyou so much for all your help... i've been struggling with this
problem for ages.

Just one last thing... I also need a simialr script for the forward
button, otherwise the same problem will arise as i will only be able
to go forward once and after that the animation will not replay.

So i need scripting that says go forward one and reset. is it as
simple as exchanging the -1 for a +1 or is it more complicated than
that? thanks again, sorry to keep bugging you.
 
C

cherylhyams

just tried replacing minus one with plus one and it works as a forward
button so thats FANTASTIC!!! Everything is working perfectly....I
can't tell you how much you have helped! This problem has been
stopping us from finishing the presentation for months, I can't
believe its finally resolved!!! THANKYOU
sooooooooooooooooooooooooooooooooo much
 
D

David M. Marcovitz

I'm glad you got it working. There are certain types of errors that cause
all your scripts to stop working, so you might try deleting everything
from the module with the VBA and putting it back in.

Changing from -1 to +1 should work for your next buttons.

--David

--
David M. Marcovitz
Microsoft PowerPoint MVP
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/

(e-mail address removed) wrote in @b75g2000hsg.googlegroups.com:
 
D

David M. Marcovitz

I'm glad I could help. I also really appreciated your attempts to help
yourself.
--David

--
David M. Marcovitz
Microsoft PowerPoint MVP
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/

(e-mail address removed) wrote in @d57g2000hsg.googlegroups.com:
 

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