# Just want simple tickbox in non-Slideshow PowerPoint



## Helpmehelpme (Jul 19, 2020)

Hi
I'm sure there must be VBA for this, to take a tickbox inserted into a slide from the Developer tab, and make it so that, without needing to be in Slideshow to be able to click the tickbox, you would be able to tick the checkbox!

I'd like it done with VBA so there's nothing for the user to do specifically. When they see a checkbox I'd like them to either just be able to ignore it altogether, or click it and if they do that, a tick mark appears. If they change their mind and click it again, the tick mark would go. 

I'm convinced this is possible but with a bit of VBA and the tickbox from the Develop tab (without going into User Forms and the like) - am I right and can anyone help??

I don't need any messages to appear, I'm not looking to go through a presentation to find checked or unchecked tickboxes, I just want the user, NOT in Slideshow mode, to be able to tick and untick a blessed tick box - that's it .

Any help would be v v gratefully received as I cannot find anything that quite seems to fit the bill. 

Many thanks indeed.


----------



## Helpmehelpme (Jul 25, 2020)

Sorry to bump this, but does anyone have a way for making a tickbox clickable outside of being in slideshow mode (ie the user clicks the checkbox, a checkmark appears....)??

Just cannot find anything and I have searched loads on this (plus I'm pretty VBA-novice which doesn't help!).

Thank you.


----------



## Yongle (Jul 25, 2020)

Welcome to MrExcel
I suspect that you are getting no response because nobody understands what you are trying to achieve

What is the purpose of the checkbox? What happens when the user clicks on it?
What happens when it is checked \ not checked?
Why does the user need to click it?
When does the user need to click it?


----------



## Helpmehelpme (Jul 25, 2020)

Always happy to explain further.

*Purpose: *A checkbox provided for the user to click on it to say 'yes' ie agreement with the choice or statement sitting in the text box right beside the checkbox
*What happens when they click on it:* A tick appears
*What happens if they click on it a second time: *The tick disappears and goes back to being an empty checkbox
*What happens when it is not checked:* Nothing. It is perfectly ok for it to not be checked
*Why does the user need to click it:* In order to indicate 'yes' ie agreement with the choice or statement sitting in the text box right beside the checkbox.

So in effect it would toggle on ie click unchecked checkbox once, a tick would appear in it, click the checkbox again and the tick would disappear; repeat.


----------



## Yongle (Jul 25, 2020)

Thanks. But I still do not understand where you are going with this
1. What happens after the user clicks on the checkbox ?
2. What is the end result? Are you trying to use powerpoint as some kind of questionnaire and wanting to collate all the user's responses?


----------



## Helpmehelpme (Jul 25, 2020)

I'm not deploying it as a survey (I have MS Forms for that); it's a workbook for a person to work through step by step. At points they are asked do you have this a b or c - if they have b they apply a tick to the checkbox next to b.

I have no requirement to collate responses or anything like that. It is just to have the ability for the recipient of the document to work through that workbook document and click a checkbox (a tick appears) - they go off and do something else. They click a different checkbox (same thing happens as it did on the first checkbox they clicked on ie a tick appears) - they go off and do something else. They go back to an already ticked checkbox and click it again (the tick disappears).


----------



## Yongle (Jul 25, 2020)

Now you really have confused me  

The title says 
_Just want simple tickbox in non-Slideshow *PowerPoint*_
Post#6 says
_It's a *workbook* for a person to work through step by step_

Sorry - out of time for today


----------



## Helpmehelpme (Jul 25, 2020)

I felt it was clear enough since certain of the checkbox features do only work in slideshow mode and I'm not doing a presentation as a slideshow. Hence why I made that clear in the title. So it is accurate as a title. Whether it's a workbook, a CV, a report or a presentation, the functionality that I need from the checkbox is exactly the same, and I do feel I've set out how I want it to work pretty clearly - I'm not sure I can explain it any clearer actually.  

I very much appreciate your assistance so far and would of course be delighted to pick it up with you or other contributors another time. Have a great Saturday. I too am clocking off as I've been working on that workbook and other associated documentation since early doors so I'm now off to watch some telly, have a coffee, and cuddle my dog .


----------



## Yongle (Jul 25, 2020)

*In an Excel workbook:*
Insert a checkbox (either Form Control or Active-x ) directly onto a worksheet
Cancel Design Mode if required
Click on checkbox (to check)
Click again on checkbox (to uncheck)


----------



## Worf (Jul 25, 2020)

In order for this to work, run the trap events routine first:


```
' Module 1
Dim pptob As New EventClass, trapflag As Boolean

Sub TrapEvents()
MsgBox "Trapping event..."
If trapflag = True Then
    MsgBox "the EventHandler is already active.", _
    vbInformation + vbOKOnly, "PP Event Handler"
    Exit Sub
End If
Set pptob.PPTEvent = Application
trapflag = True
End Sub

Sub ReleaseTrap()
If trapflag = True Then
    Set pptob.PPTEvent = Nothing
    Set pptob = Nothing
    trapflag = False
End If
End Sub
```


```
'PowerPoint class module named EventClass

Public WithEvents PPTEvent As Application

Private Sub Class_Terminate()
MsgBox "EventHandler is now inactive.", vbInformation + vbOKOnly, _
"PowerPoint Event Handler Example"
End Sub

Private Sub PPTEvent_WindowSelectionChange(ByVal Sel As Selection)
If Sel.Type <> 0 Then
    If Sel.Type = 2 And Sel.ShapeRange.Name Like "CheckBox*" Then
        Sel.ShapeRange.OLEFormat.Object.Value = _
        Not Sel.ShapeRange.OLEFormat.Object.Value
        Sel.Unselect
    End If
End If
End Sub

Private Sub Class_Initialize()
MsgBox "The EventHandler class has been initialized."
End Sub
```


----------



## Helpmehelpme (Jul 19, 2020)

Hi
I'm sure there must be VBA for this, to take a tickbox inserted into a slide from the Developer tab, and make it so that, without needing to be in Slideshow to be able to click the tickbox, you would be able to tick the checkbox!

I'd like it done with VBA so there's nothing for the user to do specifically. When they see a checkbox I'd like them to either just be able to ignore it altogether, or click it and if they do that, a tick mark appears. If they change their mind and click it again, the tick mark would go. 

I'm convinced this is possible but with a bit of VBA and the tickbox from the Develop tab (without going into User Forms and the like) - am I right and can anyone help??

I don't need any messages to appear, I'm not looking to go through a presentation to find checked or unchecked tickboxes, I just want the user, NOT in Slideshow mode, to be able to tick and untick a blessed tick box - that's it .

Any help would be v v gratefully received as I cannot find anything that quite seems to fit the bill. 

Many thanks indeed.


----------



## Helpmehelpme (Jul 26, 2020)

Yongle said:


> *In an Excel workbook:*
> Insert a checkbox (either Form Control or Active-x ) directly onto a worksheet
> Cancel Design Mode if required
> Click on checkbox (to check)
> Click again on checkbox (to uncheck)



Hi. I'm not sure where you've determined that I'm referencing an Excel document - my question title states PowerPoint and when you asked for further clarification I said I had created a 'workbook' for someone to work through ticking responses and choices - not an Excel work_sheet. _

However the functionality you describe is of course exactly what I want (just in PowerPoint (and not in slideshow mode)).


----------



## Helpmehelpme (Jul 26, 2020)

Worf said:


> In order for this to work, run the trap events routine first:



Thanks v much for this Worf I'll certainly give this a go.

Bear with me as I have VBA'd before but I'm nowhere even approaching competent let alone expert (!) so, these here checkboxes are on several pages of this document so do I need to add the VBA to every page where I need it or as its written does this cover of anywhere in this document?

Also, what type of module do I choose - User Form, Module, Class Module?

Cheers


----------



## Helpmehelpme (Jul 26, 2020)

Worf said:


> In order for this to work, run the trap events routine first:



Thank you very much indeed for this. Do I run it in a module or class module?

Does the VBA you've provided cover all the sheets (ie 'where' should I 'put' it exactly in terms of the structure eg do I need to add it to every page that has checkboxes?). Low competency VBAer here for which, apologies.


----------



## Helpmehelpme (Jul 26, 2020)

Apologies for potentially posting a Reply twice - had a glitch with Windows.


----------



## Worf (Jul 26, 2020)

The code covers all check boxes on all slides.
I made a change to the class module code, use version below.
At the VBE, choose Insert>Module and paste the indicated code from the other post. Note the green comments on the code.
Choose Insert>Class Module, rename it as indicated and paste the corresponding code.
Run the trap event code and that is it. Would you like to have my test presentation?


```
'PowerPoint class module named EventClass

Public WithEvents PPTEvent As Application

Private Sub Class_Terminate()
MsgBox "EventHandler is now inactive.", vbInformation + vbOKOnly, _
"PowerPoint Event Handler Example"
End Sub

Private Sub PPTEvent_WindowSelectionChange(ByVal Sel As Selection)
If Sel.Type <> 0 And Sel.Type <> 1 Then
    If Sel.Type = 2 And Sel.ShapeRange.Name Like "CheckBox*" Then
        Sel.ShapeRange.OLEFormat.Object.Value = _
        Not Sel.ShapeRange.OLEFormat.Object.Value
        Sel.Unselect
    End If
End If
End Sub

Private Sub Class_Initialize()
MsgBox "The EventHandler class has been initialized."
End Sub
```


----------



## Helpmehelpme (Aug 2, 2020)

Thanks for this. I've put it in now and re-saved as macro-enabled PowerPoint. Let me show you what I did and how that looked in F11. Then the next image is what happens if I click into a checkbox in the document, I get this click module. When you'd written 'rename it' I couldn't see where there was an option for me to rename anything (I thought you may have meant the name of the module but I couldn't see a way to do this).


----------



## Worf (Aug 2, 2020)

Take a look at my test presentation:









						checkbox.pptm
					

Shared with Dropbox




					www.dropbox.com


----------



## Helpmehelpme (Aug 21, 2020)

Thanks very much for sharing that with me - but I just don't know what's happening or what I need to do ......

In your document if I click on the checkbox (bearing in mind I'm doing this NOT in Presenter/Slideshow mode) nothing at all happens...? 

What you have the tick box is ticked, I'm expecting when I click on it the tick will go (repeat, repeat, repeat, like a toggle in effect). But nothing happens so I'm a bit unsure what I need to do.


----------



## Worf (Aug 23, 2020)

You need to start by running the trap events routine, did you do that?


----------



## Helpmehelpme (Aug 28, 2020)

Worf said:


> You need to start by running the trap events routine, did you do that?


Hi there. I don't know how to 'run trap events'... sorry! 
I can see 'Run' (giving options of Run sub/user form, Break or Reset) and I can see Module (General) Trap events. What I do with that I'm really sorry but I don't know how to do that.


----------



## Helpmehelpme (Jul 19, 2020)

Hi
I'm sure there must be VBA for this, to take a tickbox inserted into a slide from the Developer tab, and make it so that, without needing to be in Slideshow to be able to click the tickbox, you would be able to tick the checkbox!

I'd like it done with VBA so there's nothing for the user to do specifically. When they see a checkbox I'd like them to either just be able to ignore it altogether, or click it and if they do that, a tick mark appears. If they change their mind and click it again, the tick mark would go. 

I'm convinced this is possible but with a bit of VBA and the tickbox from the Develop tab (without going into User Forms and the like) - am I right and can anyone help??

I don't need any messages to appear, I'm not looking to go through a presentation to find checked or unchecked tickboxes, I just want the user, NOT in Slideshow mode, to be able to tick and untick a blessed tick box - that's it .

Any help would be v v gratefully received as I cannot find anything that quite seems to fit the bill. 

Many thanks indeed.


----------



## Worf (Aug 30, 2020)

Open my test presentation
Press alt +F8 to bring up the macro dialog box
Run the trap events macro
Accept the message box information
Click the check box.


----------



## Helpmehelpme (Aug 31, 2020)

Ahhh, ok. Thank you. 

Done that and checkbox works absolutely fantastic - thank you so much for that. 
Will do same on my own document now.

Questions:
If I copy and paste a checkbox will it automatically 'pick up' that functionality (or would I need to repeat it each time a further checkbox was added)?
If I send that document to someone, do they have to run that trap events macro first themselves before it would work for them?

Just want to make sure in case I need to include any instructions to help the recipient of the document (or even to add in some trigger (if possible/necessary) that the first time that document is opened it runs the trap event automatically cos if not I could see this being a difficulty for many recipients to know what to do - if they are equally as non-VBA 'expert' as me!).


----------



## Worf (Sep 3, 2020)

If you insert a new check box it will pick up the functionality.

Yes, other users will have to start by running that macro. Automating this process is not trivial, it would require an add-in.

An easier way could be a button in presentation mode that when clicked would run the macro. Do you think this is a good idea?


----------

