Results 1 to 11 of 11
  1. #1
    4 Star Lounger
    Join Date
    Sep 2002
    Location
    Stafford, Staffordshire, England
    Posts
    585
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Counting Button Clicks (2003)

    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
    <font color=blue><font face="Script MT Bold"><big>Rob</big></font face=script></font color=blue>

  2. #2
    3 Star Lounger
    Join Date
    Feb 2007
    Location
    Durham, Durham, United Kingdom
    Posts
    286
    Thanks
    0
    Thanked 10 Times in 10 Posts

    Re: Counting Button Clicks (2003)

    Only with vba code

  3. #3
    4 Star Lounger
    Join Date
    Sep 2002
    Location
    Stafford, Staffordshire, England
    Posts
    585
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Counting Button Clicks (2003)

    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
    <font color=blue><font face="Script MT Bold"><big>Rob</big></font face=script></font color=blue>

  4. #4
    3 Star Lounger
    Join Date
    Feb 2007
    Location
    Durham, Durham, United Kingdom
    Posts
    286
    Thanks
    0
    Thanked 10 Times in 10 Posts

    Re: Counting Button Clicks (2003)

    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.T extRange = 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

  5. #5
    4 Star Lounger
    Join Date
    Sep 2002
    Location
    Stafford, Staffordshire, England
    Posts
    585
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Counting Button Clicks (2003)

    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(?)
    <font color=blue><font face="Script MT Bold"><big>Rob</big></font face=script></font color=blue>

  6. #6
    3 Star Lounger
    Join Date
    Feb 2007
    Location
    Durham, Durham, United Kingdom
    Posts
    286
    Thanks
    0
    Thanked 10 Times in 10 Posts

    Re: Counting Button Clicks (2003)

    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)

  7. #7
    4 Star Lounger
    Join Date
    Sep 2002
    Location
    Stafford, Staffordshire, England
    Posts
    585
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Counting Button Clicks (2003)

    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
    <font color=blue><font face="Script MT Bold"><big>Rob</big></font face=script></font color=blue>

  8. #8
    3 Star Lounger
    Join Date
    Feb 2007
    Location
    Durham, Durham, United Kingdom
    Posts
    286
    Thanks
    0
    Thanked 10 Times in 10 Posts

    Re: Counting Button Clicks (2003)

    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"

  9. #9
    4 Star Lounger
    Join Date
    Sep 2002
    Location
    Stafford, Staffordshire, England
    Posts
    585
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Counting Button Clicks (2003)

    <img src=/S/bash.gif border=0 alt=bash width=35 height=39>
    Point taken. Many thanks for your time and expertise. As Arnie may have said, I may be back!
    <font color=blue><font face="Script MT Bold"><big>Rob</big></font face=script></font color=blue>

  10. #10
    3 Star Lounger
    Join Date
    Feb 2007
    Location
    Durham, Durham, United Kingdom
    Posts
    286
    Thanks
    0
    Thanked 10 Times in 10 Posts

    Re: Counting Button Clicks (2003)

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

  11. #11
    4 Star Lounger
    Join Date
    Sep 2002
    Location
    Stafford, Staffordshire, England
    Posts
    585
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Counting Button Clicks (2003)

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

    Regards
    <font color=blue><font face="Script MT Bold"><big>Rob</big></font face=script></font color=blue>

Posting Permissions

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