Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General PowerPoint Questions / June 2006

Tip: Looking for answers? Try searching our database.

Object Colour change on click

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
SpencerMC - 07 Jun 2006 13:31 GMT
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
John Wilson - 07 Jun 2006 14:20 GMT
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
Signature

-----------------------------------------
Did that answer the question / help?
_____________________________
John Wilson
Microsoft Certified Office Specialist

> 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
[quoted text clipped - 4 lines]
>
> Thanks Spence
SpencerMC - 07 Jun 2006 14:28 GMT
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
on the objects i.e. only have to edit it once rather than three times for
each item.

> Hi Spencer
>
[quoted text clipped - 12 lines]
> >
> > Thanks Spence
David M. Marcovitz - 07 Jun 2006 14:49 GMT
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

Signature

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/

> Thanks John,
>
[quoted text clipped - 22 lines]
>> >
>> > Thanks Spence
Steve Rindsberg - 07 Jun 2006 15:44 GMT
> 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
> on the objects i.e. only have to edit it once rather than three times for
> each item.

This makes sense, then.  So long as you understand that a VBA solution won't work in
the free Viewer, but it doesn't sound as though that's an issue in your situation.

So, add this macro and assign it to each shape whose color you want to "flip" as an
action setting.  Set the color of the shape to whatever color you've defined as the
default color.

We could probably take it a step beyond and teach it to work with any clicked shape
and remember the shape's original color, then set it back on re-click if need be.

Sub FlipColors(oSh as Shape)

Dim lDefaultColor as Long
Dim lHighlightColor as Long

' Edit these as needed
lDefaultColor = RGB(0,0,255)      ' pure blue
lHightlightColor = RGB(255,255,0)  ' yellow

With oSh.Fill.ForeColor

 Select Case .RGB
  Case lDefaultColor
     .RGB = lHighlightColor
     
  Case lHighlightColor
     .RGB = lDefaultColor
 End Select

End With

End Sub

End Sub
Steve Rindsberg - 07 Jun 2006 16:31 GMT
Round two:

Highlight shapes in PowerPoint
http://www.rdpslides.com/pptfaq/FAQ00798.htm

This one remembers the original shape's color and sets it back to that (which also
means that you don't have to set the shape to any particular color to make it work
in the first place).

And because PPT won't let you assign macros to multiple selected shapes at a time,
there's this:

Assign an Action Setting, Run Macro action to multiple shapes at once
http://www.rdpslides.com/pptfaq/FAQ00799.htm

-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ:  www.pptfaq.com
PPTools:  www.pptools.com
================================================
Kathy Jacobs - 07 Jun 2006 18:17 GMT
Steve:
Do we get a prize for suggesting FAQ entry number 800?

> Round two:
>
[quoted text clipped - 19 lines]
> PPTools:  www.pptools.com
> ================================================
Steve Rindsberg - 07 Jun 2006 20:11 GMT
> Steve:
> Do we get a prize for suggesting FAQ entry number 800?

<G>

Thought the same thing as I watched it u/l.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.