Object Colour change on click

S

SpencerMC

Using Visual Basic, is there a script that would change the colour of an
object (or button) when it is clicked and then change it to a different
colour if clicked again? I'm designing a quiz and want to select an shape
containing an answer; for that to change colour so that we all know which one
we're talking about. and then to change colour again so that we know we've
dealt with it. Hope that makes sense.

Thanks Spence
 
J

John Wilson

Hi Spencer

You can create this effect without vba.

You need three buttons / shapes each a different colour. Stack them on top
of each other and set the top two shapes with an exit animation triggered by
a click on itself
--
 
S

SpencerMC

Thanks John,

That certainly is one easier solution. However, it would be nice not to have
to do so much copying and pasting.

I was thinking of useing VB so that later on it is easier to edit the text
 
D

David M. Marcovitz

Yes, this is possible with VBA. Here is an example:

Sub FlipColor(oShp As Shape)
If oShp.Fill.ForeColor.RGB = vbBlue Then
oShp.Fill.ForeColor.RGB = vbRed
Else
oShp.Fill.ForeColor.RGB = vbBlue
End If
End Sub

Assign this macro to a shape and each time you click it, it will change
alternate between blue and red.

--David

--
David M. Marcovitz
Microsoft PowerPoint MVP
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top