• Counting Button Clicks (2003)

    Author
    Topic
    #449024

    I have searched extensively for my requirement but without success. I would like a user to click a command button on a slide and the number of clicks be displayed in a textbox (or something) on another slide. In essence, I would like the other slide to act as a counter. Is there a simple way of doing this? TIA.

    Regards

    Viewing 0 reply threads
    Author
    Replies
    • #1099758

      Only with vba code

      • #1099760

        Hi John

        Yours was the first site I checked out but I could not find any reference to my needs. I played around with ppt vba but it is still a bit esoteric. The syntax is not what I’m used to. Would you provide me with some vba to do the job.

        Ta

        Regards

        • #1099761

          Something like:

          (Assuming eg that the textbox was shape 3 on slide 3)
          In the On click code for the command button

          Static Icount As Integer
          Icount = Icount + 1
          ActivePresentation.Slides(3).Shapes(3).TextFrame.TextRange = CStr(Icount)

          Note this will keep counting up until you close the presenation so you may want a reset button that just runs Icount=0

          • #1099762

            Thanks for your time, John. I have just inserted a textbox from the Control Toolbox into Slide 2. How do I assign it a Shapes reference? Shapes(?)

            • #1099768

              Do you NEED a control textbox (or for that matter a command button) you can do this with an action button and standard textbox.

              If you do use a control textbox you can refer to it like this (assuming it has the default name)

              ActivePresentation.Slides(2).Shapes(“TextBox1”) _
              .OLEFormat.Object.Text = CStr(Icount)

            • #1099777

              Thanks John. That is really useful. Just one more request. What I’m trying to do is to keep a running total of correct answers as determined by which button is clicked. Thus, if a particular button is clicked on different slides, the value in the textbox on the “counting slide” is updated accordingly until the presentation ends. In other words, it keeps a record of correct answers to questions on any given slide.

              Regards

              Rob

            • #1099796

              OK (Always start with the real question!)

              Don’t use a command button at all will make this much easier

              Alt f11 to vb editor and Insert Module

              Add this code
              Dim Icount as Integer
              Sub CorrectAns()
              Icount=count+1
              whatever code to change text in box goes here
              End Sub

              Insert however many action buttons (not command buttons) and give each on an action of Run Macro “CorrectAns”

            • #1099799

              bash
              Point taken. Many thanks for your time and expertise. As Arnie may have said, I may be back!

            • #1099801

              This might help. Shows also how to give result and reset counters

            • #1099919

              Thanks for the attached file, John. It’s been of tremendous use.

              Regards

    Viewing 0 reply threads
    Reply To: Reply #1099777 in Counting Button Clicks (2003)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information:




    Cancel