From: RJ on
Can anyone help with the following:
I want a vba code which will take me to the second previously viewed slide
minus 1.

Example:
Slide #3 is viewed. An action button then takes the viewer to slide#7.
Another action button takes the viewer to slide #10. On slide #10 I would
like there to be an action button connected to a macro that will take the
viewer directly to slide #2. (To the previous slide viewed (#7), then the
next previous slide viewed (#3), then to the slide positioned just before
slide #3 (#2).

Can this be done?

Thanks.
RJ
From: David Marcovitz on
On 5/5/10 1:55 PM, RJ wrote:
> Can anyone help with the following:
> I want a vba code which will take me to the second previously viewed slide
> minus 1.
>
> Example:
> Slide #3 is viewed. An action button then takes the viewer to slide#7.
> Another action button takes the viewer to slide #10. On slide #10 I would
> like there to be an action button connected to a macro that will take the
> viewer directly to slide #2. (To the previous slide viewed (#7), then the
> next previous slide viewed (#3), then to the slide positioned just before
> slide #3 (#2).
>
> Can this be done?
>
> Thanks.
> RJ

This is definitely doable, but it is going to require some coding. This
is untested off the top of my head, but it should get you started.

Dim prevSlide as Long
Dim prevPrevSlide as Long


'Call this procedure with a number and it will go to that slide
'keeping track of the last two slides visited
Sub GotoNewSlide (theNewSlide as Long)
prevPrevSlide = prevSlide
prevSlide = ActivePresentation.SlideShowWindow.View.Slide.SlideIndex
ActivePresentation.SlideShowWindow.View.GotoSlide theNewSlide
End Sub


'Go to the previous previous slide - 1
Sub GoBackBackMinus1()
If prevPrevSlide <= 1 Or prevPrevSlide >
ActivePresentation.Slides.Count Then
'Decide what you want to do if you can't do what you want
'and put it here
Else
GotoNewSlide(prevPrevSlide - 1)
End If
End Sub

Just be sure that every time you want to go to a slide, you call
GotoNewSlide, instead of a regular hyperlink because that is what keeps
track of the previous slides. An alternative is to use an event trap to
trap every time you change slides, but someone else would have to help
you with that.

--David

--
David M. Marcovitz
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/
Microsoft PowerPoint MVP
Associate Professor, Loyola University Maryland
From: John Wilson on
There is code here to do this:
http://www.pptalchemy.co.uk/vbasamples.html

"RJ" <RJ(a)discussions.microsoft.com> wrote in message
news:D4187CB4-E656-47C2-B765-FCABEA55F118(a)microsoft.com...
> Can anyone help with the following:
> I want a vba code which will take me to the second previously viewed slide
> minus 1.
>
> Example:
> Slide #3 is viewed. An action button then takes the viewer to slide#7.
> Another action button takes the viewer to slide #10. On slide #10 I would
> like there to be an action button connected to a macro that will take the
> viewer directly to slide #2. (To the previous slide viewed (#7), then the
> next previous slide viewed (#3), then to the slide positioned just before
> slide #3 (#2).
>
> Can this be done?
>
> Thanks.
> RJ
>
> __________ Information from ESET Smart Security, version of virus
> signature database 5089 (20100505) __________
>
> The message was checked by ESET Smart Security.
>
> http://www.eset.com
>
>
>

__________ Information from ESET Smart Security, version of virus signature database 5089 (20100505) __________

The message was checked by ESET Smart Security.

http://www.eset.com



From: John Wilson john AT technologytrish.co DOT on
Sorry I misread the question!
--
john ATSIGN PPTAlchemy.co.uk

Free PPT Hints, Tips and Tutorials
http://www.pptalchemy.co.uk/powerpoint_hints_and_tips_tutorials.html






"John Wilson" wrote:

> There is code here to do this:
> http://www.pptalchemy.co.uk/vbasamples.html
>
> "RJ" <RJ(a)discussions.microsoft.com> wrote in message
> news:D4187CB4-E656-47C2-B765-FCABEA55F118(a)microsoft.com...
> > Can anyone help with the following:
> > I want a vba code which will take me to the second previously viewed slide
> > minus 1.
> >
> > Example:
> > Slide #3 is viewed. An action button then takes the viewer to slide#7.
> > Another action button takes the viewer to slide #10. On slide #10 I would
> > like there to be an action button connected to a macro that will take the
> > viewer directly to slide #2. (To the previous slide viewed (#7), then the
> > next previous slide viewed (#3), then to the slide positioned just before
> > slide #3 (#2).
> >
> > Can this be done?
> >
> > Thanks.
> > RJ
> >
> > __________ Information from ESET Smart Security, version of virus
> > signature database 5089 (20100505) __________
> >
> > The message was checked by ESET Smart Security.
> >
> > http://www.eset.com
> >
> >
> >
>
> __________ Information from ESET Smart Security, version of virus signature database 5089 (20100505) __________
>
> The message was checked by ESET Smart Security.
>
> http://www.eset.com
>
>
>