Just want simple tickbox in non-Slideshow PowerPoint

Helpmehelpme

New Member
Joined
Jul 19, 2020
Messages
13
Office Version
  1. 365
Platform
  1. Windows
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

New Member
Joined
Jul 19, 2020
Messages
13
Office Version
  1. 365
Platform
  1. Windows
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 worksheet.

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

Some videos you may like

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.

Helpmehelpme

New Member
Joined
Jul 19, 2020
Messages
13
Office Version
  1. 365
Platform
  1. Windows
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

New Member
Joined
Jul 19, 2020
Messages
13
Office Version
  1. 365
Platform
  1. Windows
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

New Member
Joined
Jul 19, 2020
Messages
13
Office Version
  1. 365
Platform
  1. Windows
Apologies for potentially posting a Reply twice - had a glitch with Windows.
 

Worf

Well-known Member
Joined
Oct 30, 2011
Messages
4,010

ADVERTISEMENT

  • 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?

VBA Code:
'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

New Member
Joined
Jul 19, 2020
Messages
13
Office Version
  1. 365
Platform
  1. Windows
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).
 

Attachments

  • Module & class module snip.png
    Module & class module snip.png
    117.5 KB · Views: 4
  • Upon clicking clickbox in document.png
    Upon clicking clickbox in document.png
    4 KB · Views: 4

Worf

Well-known Member
Joined
Oct 30, 2011
Messages
4,010

ADVERTISEMENT

Take a look at my test presentation:

 

Helpmehelpme

New Member
Joined
Jul 19, 2020
Messages
13
Office Version
  1. 365
Platform
  1. Windows
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

Well-known Member
Joined
Oct 30, 2011
Messages
4,010
You need to start by running the trap events routine, did you do that?
 

Helpmehelpme

New Member
Joined
Jul 19, 2020
Messages
13
Office Version
  1. 365
Platform
  1. Windows
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! :eek:
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.
 

Watch MrExcel Video

Forum statistics

Threads
1,108,939
Messages
5,525,741
Members
409,661
Latest member
pprabha

This Week's Hot Topics

Top