PDA

View Full Version : Macro - turn object different colour



Sir Babydum GBE
10-12-2006, 07:04 AM
Hi

I have a PowerPoint presentation quiz show in the style of Who Wants to be a millionaire. It's created in PowerPoint 2003, but some only have PP2000 - which means you can't use the "trigger" function where an object does something when a different object is clicked.

I know i can set an objects action to run a macro, but how do i say with vba something like "turn this object a different colour"?

Thanks

BD

TrippyTom
10-12-2006, 02:41 PM
If it's a shape, you should be able to give it a name when you create the shape... then refer back to that shape later when you want to change the color.

Here's a sample of how I used it:

mySlide = ActiveWindow.View.Slide.SlideIndex
myColor = RGB(255, 0, 0) 'red <-- Change this value to whatever you want if you don't like red
With ActivePresentation.Slides(mySlide).Shapes.AddShape(Type:=msoShapeRectangle, Top:=48.24, Left:=0, Width:=720, Height:=0)
.Name = "y1"
.Line.ForeColor.RGB = myColor
End With

Then later if you want to change it from Red to something else, check for the shape named "y1" (in this case)