# Vba for PowerPoint



## Malcolm torishi (Jan 11, 2014)

Hi 
i know this is an excel site but I need some help with VBA Code in PowerPoint.  What I have are a number of checkboxes on my first PowerPoint slide presentation eg checkbox 1 = slide 1 checkbox 2= slide 2 and so on. I have 50 slides and 50 checkboxes. I also have 1 command button under the check boxes. What I wold like to know is the VBA Code so when I press the command button it deletes all the slide which has not been ticked in the checkboxes  thanks


----------



## Trevor G (Jan 11, 2014)

What type of check box have you added? Which version of PowerPoint are you using? Have you looked at the Object Browser in the PowerPoint VBA.


----------



## Malcolm torishi (Jan 11, 2014)

I am using 2010, the check boxes are the only ones I think you can use from the developer tab.  No I have not looked at the object browser .


----------



## Trevor G (Jan 11, 2014)

I have used a userform from PowerPoint VBA added to Check boxes and a command button to the form. Named the check boxes chk1 and chk2 behind the command button used the following code:



> If Me.chk1.Value = True Then
> ActivePresentation.Slides(2).Delete
> End If


----------



## Malcolm torishi (Jan 11, 2014)

Thank you I will try that


----------



## Malcolm torishi (Jan 13, 2014)

Still need some help here please.  I have tried Trevor's code above, but what I want the checkbox to do when ticked is keep the slide not delete it.  Also another thing I need it to do is delete multiple slide numbers in one go UVA a command button. Please can any one help thank you


----------



## Trevor G (Jan 14, 2014)

Have you tried change the code from True to False that will delete the slides where the check boxes hasn't been ticked. Rather than have 50 if statements you could look at using a Dim Boolean code line.


----------

