PDA

View Full Version : PowerPoint VBA to change shape color on Click



mchilapur
02-18-2019, 10:51 AM
Hello all,
I am trying to create an powerpoint Quiz template. Each slide have a question with 4 options below. These 4 options are rounded Rectangles with No-Fill.
I am looking for a VBA which can be assigned to each of these shapes, which On-Click, must change color to green if answer is correct and change color to Red if answer is wrong.

In the attached template, in slide 1, option 1 is correct answer and other 3 are wrong.
In slide 2, Option 3 is correct answer and other 3 are wrong.

Can anyone please help me with the code.? I know i am asking it from scratch, sorry for that, but i am very new to PowerPoint VBA.

Thanks in advance

John Wilson
02-18-2019, 12:04 PM
Assign either of these to the corresponding shape


Sub isWrong(oshp As Shape)
oshp.Fill.ForeColor.RGB = vbRed
End Sub


Sub isCorrect(oshp As Shape)
oshp.Fill.ForeColor.RGB = vbGreen
End Sub


However there are several problems with this approach

A The user can click all of the shapes
B The colours will not reset to white when the quiz is over.