Consulting

Results 1 to 3 of 3

Thread: VBA Code Help?

  1. #1
    VBAX Newbie
    Joined
    Apr 2014
    Posts
    2
    Location

    Cool VBA Code Help?

    I'm making a board game and I have trivia as the chance "cards" (actually slides) on Powerpoint. The first slide shows a question mark and has 3 buttons on the slide for 3 areas of the board people can land on (Yellow, Red, Blue). Teams will be playing on a physical board so I got that covered. So when you land on a yellow spot, you would refer to the Powerpoint and click on the yellow button, and it will take you to the first slide under the yellow section (for example, the yellow section of the slides are slides 2 - 28, the red section is 30-45 etc). There is a button to click back to the first slide where you can re-navigate to another button.

    The thing is, I want the slides to be shown in order and not repeat when you click any of the buttons, so when you click yellow the first time, it will show slide 2 -> go back to the first slide -> click yellow again -> shows slide 3, etc up until slide 28, where it'll go to an end slide that basically said you ran out of cards). This concept applies to all the sections (so for red, if you clicked it for the first time, it will show slide 30, then 31, 32, 33 etc). Of course different teams may be on different colors, so it would need to remember which slide it left off on in each section. I'm not sure how to code this in VBA or if it even requires VBA at all... but it seems like it SHOULD be a looping if function.

    I'm not a coder and I would really appreciate any input or help on this I can get!

    Thank you all

  2. #2
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,096
    Location
    Could be done without code .

    Have a stack of (eg yellow) shapes. The top shape links to slide 2 and also triggers an exit animation to remove itself. Repeat this for the other shapes in the stack with different links to slides. Haven't tested but it should work.

    Witrh code you could increment a tag to indicate the slide to link to


    Sub jump_andIncrement(oshp As Shape)
    Dim lngJump As Long
    'start at slide 2
    If oshp.Tags("COUNT") = "" Then oshp.Tags.Add "COUNT", "2"
    lngJump = CLng(oshp.Tags("COUNT"))
    If lngJump < ActivePresentation.Slides.Count Then
    ActivePresentation.SlideShowWindow.View.GotoSlide (lngJump)
    'increment
    oshp.Tags.Add "COUNT", oshp.Tags("COUNT") + 1
    Else
    'start again
    oshp.Tags.Add "COUNT", "2"
    End If
    End Sub
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  3. #3
    VBAX Newbie
    Joined
    Apr 2014
    Posts
    2
    Location
    Quote Originally Posted by John Wilson View Post
    Could be done without code .

    Have a stack of (eg yellow) shapes. The top shape links to slide 2 and also triggers an exit animation to remove itself. Repeat this for the other shapes in the stack with different links to slides. Haven't tested but it should work.
    Sorry for the late reply but I did this and it works perfectly! Thank you so much for the suggestion, I really appreciate it !!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •