问题
I'm trying to make an educational interactive presentation for kinder children using Power Point, and I'm trying to do a kind of test/activity in which the children have to click on some pictures according to the question. Some will be right, some don't. (for instance: can you point the tools used by a fireman? and show 4 images of different tools) Using the mousemove event, I can reproduce a sound that says the name of the object, and using the click event I can reproduce another sound to tell the children "wrong" or "right". Now, I would like to change the border of the picture they are clicking on (color and or width), but I have no clue how to do it in VBA. It must be very easy, but I don't know the sintax :-( Any help? Please? Thank you!
回答1:
You would be surprised but it's not so easy as you expected, of course, when doing smartly with classes and events.
I'll give you simple idea, so if you have time and really need it you could go this way. But there would be some problems- you will have to figure out how could you get starting borders of your shapes.
Here is idea how to start.
name each of the shape on the slide- select one and run the following instruction in Immediate window in VBA editor, eg.:
ActiveWindow.Selection.ShapeRange.Name = "Fireman"
to change the color and line write macro for each shape (this will run only in slideshow view):
Sub FiremanClick() With SlideShowWindows(1).View.Slide.Shapes("Fireman").Line .Weight = 2 .ForeColor.RGB = RGB(255, 0, 0) End With End Sub
in application right-click fireman shape and associate action with macro you wrote.
you will need to figure out how to set back standard setting of each shape and when.
回答2:
For some reason, some kind of bug happens when setting the border shape color first and then the weight, the shape border color becomes the generic blue one in PowerPoint 2010.
来源:https://stackoverflow.com/questions/15624199/vba-power-point-changing-image-border-color-on-click