How to Randomly Shuffle Questions & Answer Order in PowerPoint Quiz Game [PPT VBA Tutorial]

Поделиться
HTML-код
  • Опубликовано: 2 окт 2024
  • How to Randomly Shuffle Questions & Answer Order in PowerPoint Quiz Game [PPT VBA Tutorial]
    Download code:
    pptvba.com/ppt...
    In this Interactive PowerPoint Quiz Game Module, we will be shuffling the order of the questions such that all the questions are shown to the students with no repetition. We achieve this by generating random orders and moving slides to a random position within a given range.
    To generate the order of those multiple-choice answer boxes, we rename those four boxes as “a1, a2, a3, a4”. And then, we make an array and shuffle that to get all the 16 combinations of “1,2,3,4”. Based on the order of the sequence, the answer boxes: “a1, a2, a3, a4” are arranged in slide-show mode.
    Intro music by Ashwin Subrahm
    Background music: Distant Lakey Inspired
    I also do freelancing, contact me:
    Bhavesh Shaha,
    bhavshaha@gmail.com
    / bhaveshshaha
    basicallybhavesh (DMs are open)
    www.pptvba.com

Комментарии • 48

  • @ABSBOnline
    @ABSBOnline 4 года назад +2

    অসাধারণ... অসাধারণ... অসাধারণ... Excellent... Excellent... Excellent... Thank you once again for your quick reply...I really fall in love with your programming wizard.. It is really fantastic...

    • @PPTVBA
      @PPTVBA  4 года назад

      Thank you very much! I appreciate your kind words.

  • @Yoyl60Alt
    @Yoyl60Alt 3 года назад +1

    amazing good job! thank for your helpful videos

  • @1966bustabeat
    @1966bustabeat 3 года назад +1

    Very new to VB in PPT.
    I'm confused to how and why you are coding in module one. What's the significance of putting the code in module one when the rest of the code is on Slide Layout 24?

    • @PPTVBA
      @PPTVBA  3 года назад +1

      Hello! Thanks for your question. This is a very apt question.
      I have few ActiveX Controls: Label present in my slidelayout. (Report card). That's why I added the code *ca.caption = ca.caption + 1* in the slidelayout where it was present.
      If I had typed those codes within module 1, it would have been slidelayout24.ca.caption. I'll have to reference the location too.
      Initially, whilst I made my video, I never thought that I'll be having 6 parts. Thus, to keep it very straight forward, I put the codes intially in Slidelayout.
      The best practice is to use modules. Also, I have explained the same in the *Generate Certificate from PPT Quiz Game* video too!
      Thank you.

  • @wrianty7189
    @wrianty7189 4 года назад +2

    Been watching your videos for weeks already..I am so amazed with your tutorial..I have no background with VBA...but want to learn more so that I can make more interactive games for my students...I woud be glad if you could make a video tutorial on drag and drop in powerpoint..please also include the VBA code..thank you

    • @PPTVBA
      @PPTVBA  4 года назад

      I've been researching on that, I shall post when I get a working prototype ready.

  • @apostol7
    @apostol7 4 года назад +1

    GREETINGS FROM MEXICO CITY.
    I WOULD LIKE TO LEARN MORE, GO AHEAD.

  • @ThinkersThinkThoughts
    @ThinkersThinkThoughts 3 года назад +1

    Fantastic video thanks. Do you it's possible for VBA to shuffle a deck of cards on one slide by randomising their order? Thanks

    • @PPTVBA
      @PPTVBA  3 года назад

      Yep definitely! The same codes would apply, we just have to change the values of .Top and .Left coordinates.

  • @david.starkey
    @david.starkey Год назад

    Works well in macro enabled pptm, but not macro enabled ppsm, is there a fix for this?

    • @PPTVBA
      @PPTVBA  Год назад

      What's the exact error in ppsm?

  • @damayantizepeda4929
    @damayantizepeda4929 4 года назад +1

    I'm so grateful for your videos, they save me a lot of times!
    I have a question, can I send an email of the screenshot of the final score slide??
    Again, thank you so much. Greetings from Mexico!

    • @PPTVBA
      @PPTVBA  4 года назад

      Yes of course! However, you'll need Microsoft OutLook for that. Gmail and various other email providers block when VB script tries to send an email due to security reasons.

    • @damayantizepeda4929
      @damayantizepeda4929 4 года назад

      @@PPTVBA I had been searching for some codes that can help me... I tried with this, but it does'nt function...
      Sub mailme()
      Dim outlookApp As Object
      Dim outlookMail As Object
      Dim currPres As Presentation
      Dim singleSlide As Presentation
      Dim L As Long
      Set outlookApp = CreateObject("Outlook.Application")
      Set outlookMail = outlookApp.CreateItem(0)
      Set currPres = ActivePresentation
      currPres.SaveCopyAs Environ("TEMP") & "\SingleSlide.pptx"
      Set singleSlide = Presentations.Open(Environ("TEMP") & "\SingleSlide.pptx")
      For L = singleSlide.Slides.Count To 1 Step -1
      If L 3 Then ' three would be the slide to keep alter as needed
      singleSlide.Slides(L).Delete
      End If
      Next L
      singleSlide.Save
      On Error Resume Next
      With outlookMail
      .To = "*** Email address is removed for privacy ***" ' change of course
      .Subject = "Test Mail"
      .body = "This is the message" & vbCrLf & "Line two here"
      .Attachments.Add singleSlide.FullName
      .Send
      End With
      singleSlide.Close
      Kill (Environ("TEMP") & "\SingleSlide.pptx")
      End Sub
      If you can hielo me I will really grateful with you...
      Thank you so much for answer!

  • @HistoryRocksUK
    @HistoryRocksUK 4 года назад

    I'm confused by this. It only seems to be moving a handful of slides and not all of them. The first slide in the range (Slide 3) moves randomly (anywhere up to Slide 52 which is the final slide to move), but Slide 4 ALWAYS moves into Slide 3's position. I've run the macro about 20 times and it just keeps doing the same thing and seemingly isn't generating a random number! Please help...

    • @PPTVBA
      @PPTVBA  4 года назад +1

      Have you used the Randomize function before using the Rnd function?
      Remember, Randomize with a "z".

  • @s.a.5427
    @s.a.5427 3 года назад

    Hello! Im pretty new with VB, how do you run the shuffle code when you exit slides? As in by pressing Esc and not a button. Is that even possible?

    • @PPTVBA
      @PPTVBA  3 года назад

      ruclips.net/video/pvqNNwubr4E/видео.html
      In this video I showcased how a particular Sub-Routine (in this case, Sub ShuffleSlides) can be run by a press of key in our keyboard.
      This video should help you out! Thanks.

  • @4uchannel833
    @4uchannel833 3 года назад

    brother can you create a video on cards pair matching game in vba

  • @jtv9953
    @jtv9953 4 года назад +1

    May I know your email sir?

  • @thptquocgiatienganh
    @thptquocgiatienganh 3 года назад

    I import the questions and answers from Excel (based on your another video) and the correct answers are on A (option A). And when I randomize the answers, the correct answers on all slides appear at the same option (for example, all B, all C, all D). How can I fix the problem?

    • @PPTVBA
      @PPTVBA  3 года назад +1

      In the sub-routine to shuffle the answers, please make sure that the random numbers are generated freshly for each slide. I had updated the codes in my website where the random number is generated within the loop and not before the loop begins. If problems still persist, please feel free to send me the file and I can have a look at it.

    • @thptquocgiatienganh
      @thptquocgiatienganh 3 года назад

      @@PPTVBA the problem is fixed though I still haven't fully understood it, still need some time to understand.
      thank you a lot

  • @ttcsjonesboro
    @ttcsjonesboro 4 года назад

    Hey man i love your video but you move so fast that I cant understand especially with the accent.

    • @PPTVBA
      @PPTVBA  4 года назад

      Ah sorry about that. Is there any particular part which you found hard to understand? I can help you out there.
      Shuffling slides is pretty basic: you can just copy-paste the code and run that macro. The main reason these are kind of fast is because this is a series. The first 4 parts explain the basics of macro as I take the viewers slowly, at this stage they get accustomed to the coding.

  • @hamidshimal1733
    @hamidshimal1733 3 года назад

    I'm confused by this. The presentation after executed cause a rectangular shapes aligned to the right of the slide in slides 3 to 8

    • @PPTVBA
      @PPTVBA  3 года назад +1

      Please cross-check the name of the shape with the name in the code. Also, do check if the values of .top and .left is proper?

    • @hamidshimal1733
      @hamidshimal1733 3 года назад

      @@PPTVBA it doesn't work, How can I find out the value of Top and Left if it is appropriate ??

    • @PPTVBA
      @PPTVBA  3 года назад +1

      @@hamidshimal1733 4:41 in this video.
      Please go through the entire video and follow them step by step.
      If issues still persist, send me your file via email and I'll debug it.

    • @hamidshimal1733
      @hamidshimal1733 3 года назад

      @@PPTVBA I sent it for you by email

    • @hamidshimal1733
      @hamidshimal1733 3 года назад

      @@PPTVBA many thanks ..

  • @elmoluces7876
    @elmoluces7876 4 года назад

    Is there any other methods to shuffle the answers if the rectangles are in different positions? Thanks

    • @PPTVBA
      @PPTVBA  4 года назад

      You would need to have the 4 set positions before hand and replace the .top and .left accordingly.
      Please read my blog post on this topic for more information. Thank you!

  • @Jack-ud9db
    @Jack-ud9db Год назад

    Thank you for the codes😀

  • @joshgalban4677
    @joshgalban4677 3 года назад

    hi. how do you disable the shuffling of the choices of the answers?

    • @PPTVBA
      @PPTVBA  3 года назад

      If you don't want to shuffle, you needn't run this code, you can delete the codes that are required for shuffling the answer boxes.

  • @ookii654
    @ookii654 3 года назад

    Is there a video before this one on how to make the actual quiz game ??

    • @PPTVBA
      @PPTVBA  3 года назад

      Yep! I have a playlist on this. Please check my channel out. There is a playlist in the mains page of my channel with 6 videos pertaining to quiz games.

    • @ookii654
      @ookii654 3 года назад

      @@PPTVBA thank you.
      I'm trying to build a custom quiz using several of your great tutorials.
      I built the original quiz and added scoreboard.
      But skipped the percentage of questions right tutorial as I don't want that.
      So when I started this tutorial I had no proceed button.
      I added a shape as a button.
      Made a macros to shuffle slides (tested and worked)
      And it shuffled the slides. But doesn't progress to the next slide.
      The first question slide. .
      I'm sorry. Where do I find the code to do both shuffle and move to next slide. ?? Thank you

    • @PPTVBA
      @PPTVBA  3 года назад

      Add the following code to take it to the next slide too in the subroutine to shuffle slides:
      ActivePresentation.SlideShowWindow.View.Next

    • @ookii654
      @ookii654 3 года назад

      @@PPTVBA you are incredible!! thank you

    • @ookii654
      @ookii654 3 года назад +1

      Code worked great. Thank you so much for posting.