PPT - Change shape color + mouse hover
Solved
Ianto
-
Ianto -
Ianto -
Hello,
I have recreated the administrative map of France (with a free form for each department) on PowerPoint and I would like each department to change color when the mouse hovers over it.
1/ For the procedure: "Insert/Action/Mouse Over/Run Macro", no problem...
2/ For creating the macro that allows this effect, after long, long, very long searches on the internet, I haven't found any that achieves the desired effect. The latest one is:
Sub changecolor ()
ActivePresentation.Slides(slide number).Shapes(shape number).Fill.ForeColor.RGB = RGB(255, 0, 0)
End Sub
3/ Could someone come to my rescue... (I should note that I know nothing about VBA). Thank you.
Configuration: Windows Vista / Firefox 4.0.1
I have recreated the administrative map of France (with a free form for each department) on PowerPoint and I would like each department to change color when the mouse hovers over it.
1/ For the procedure: "Insert/Action/Mouse Over/Run Macro", no problem...
2/ For creating the macro that allows this effect, after long, long, very long searches on the internet, I haven't found any that achieves the desired effect. The latest one is:
Sub changecolor ()
ActivePresentation.Slides(slide number).Shapes(shape number).Fill.ForeColor.RGB = RGB(255, 0, 0)
End Sub
3/ Could someone come to my rescue... (I should note that I know nothing about VBA). Thank you.
Configuration: Windows Vista / Firefox 4.0.1
10 answers
-
Hello,
I redesigned everything in a more... academic way...
You can click or hover... and as a cherry on top, we display the name of the department...
See here:
https://faqword.com/index.php/powerpoint/les-animations/795.html
m@rina
--
- "On the office forum, we ask questions about office software..."
- "Oh really???"-
Impressive (...also causes a certain frustration of not mastering these languages, whether they are VBA, Javascript, html,...).
2 quick questions to add 2 more little cherries on top:
1/ There is a delay in reaction (several seconds) between the moment the pointer leaves the department area and when the red color and the name disappear (multiple names displayed, area remains red when the pointer exits, ...): does this issue have a solution?
2/ Is it possible to have a version with only "the pointer_mouse" (without the names)?
Thank you and congratulations for this excellent feedback in such a short time.
-
-
Otherwise, there's a trick without coding, hoping it's not too heavy,
You copy your map onto several different slides, and each corresponds to what you would like to display when hovering over the relevant department.
Then you insert an action by setting it to mouse hover, link to slide number, and you mark your slide in question.
Not bad?
--
Varaldi Q.
Give me 2 minutes to find you another thing... -
Thank you for your response Varaldi Q:
I have indeed already tested this solution (more accessible for me: having no knowledge of coding) and it works quite well...
(See example at: http://officeone.mvps.org/ppttips/mouse_over_effect.html)
But as you pointed out, this approach pushes my ppt to 101 slides, just for the "decor"...
...However, my initial idea is to eventually focus on each department by linking 2 or 3 cities to a certain amount of data (via hyperlinks)
The 2 problems with this solution that push me towards VBA are the following:
1/ I'm going to quickly weigh down my ppt which risks becoming unmanageable,
2/ any correction made on the first slide will have to be applied to the hundred others...
Thanks again for your response, but I will have to resume my journey towards macros... -
VBA indeed has nothing to do with JavaScript.
However, in PowerPoint, we do not use JavaScript.
Another solution would be to make a list of departments. The person clicks on the department, and it colors on the map. They can then click on the map to access the correct page.
For Varaldi Q: we could indeed say that we decolor everything, but that doesn't prevent, if we hover over the neighboring department, that it lights up.
Otherwise, there is still something I don't understand: the fact that hovering over a department and it colors gives what assurance? It doesn't say that we are on the right department. It only says that we have hovered over a department, whether it is Creuse, Ardennes, or Cantal! ;)
m@rina
--
- "On the office forum, we ask questions about office tools..."
- "Oh really???"-
-
-
-
Varaldi Q was right about your first question regarding the "interest" of this effect:
More than assurance, it is about aesthetics and/or user comfort (yes, I know this might seem a bit silly at first ;b).
Regarding your second question about the name of the department: it is one of the few things I managed to solve easily using the menu: hyperlink/Insert hyperlink/Tooltip. -
-
-
It won't change anything for the macros. In fact, you'll have to store all this data anyway, and it won't take up any less space to store it on a new slide each than to store it all on the same ones.
Basically, it's just an optical illusion that your file is heavier or lighter...
So I suggest you create a lot, a lot of slides, or store each piece of information in a separate file that you would call with a link. (But that wouldn't change anything)
--
Varaldi Q.
Give me 2 minutes to find you another thing... -
Hello,
Of course, a macro is necessary! The given example only works for a few shapes... But creating 101 slides just for a color change is madness!
With a macro, there's nothing more to store, just a few lines of code to insert...
First of all, your macro, although insufficient, is correct.
Why isn’t it working? How do you know that the shape is Shapes(1)? There's nothing certain about that.
Since you presumably have a recent version, the best approach is to name each shape using the Selection and Visibility pane. For example: dep1, dep2, dep3, etc.
Then you need to determine whether you want the color to change and remain that way. If you want it to revert to its original shape when the mouse leaves the shape, the macro needs to be completed.
You don't need 101 macros; one should be enough.
m@rina
--
- "On the office forum, we ask questions about office work..."
- "Really???" -
Hello M@rina,
To answer your questions:
1/ I don't know why it doesn't work: I activate it in "insert/action/Mouse over/Run macro" and when I go into slideshow mode, nothing happens when hovering over the shape.
2/ Yes, I have a recent version that allows me to rename my "shapes": "home/select/Selection Pane.../Selection and visibility".
3/ My intention is:
a) for the "department" shape to change color only when the mouse pointer hovers over it.
b) [resolved] to create a hyperlink (on click) to a department slide (focus), when it is filled out...
... I am open to any solution. Thank you.-
I repeat myself: how do you know that you're hovering over shapes(1)?
Instead of putting Shapes(1), put the name of a shape, and hover over that shape.
This is why your macro isn't working.
Can you give me the slide with your map of France?
https://www.cjoint.com/
-
-
This is apparently what I did on the ppt I'm sending you (department 49, I renamed it "dep49" and put Shapes(dep49)): ...but nothing happens.
-
Désolé, je ne peux pas accéder aux liens externes. Veuillez copier le texte que vous souhaitez traduire ici.
-
Re...
Look here:
https://www.cjoint.com/?AFdtnbGvoFR
Instead of mouse hovering, I've set it to mouse click.
Mouse hovering is really not feasible.
There's one action possible when you hover the mouse over the shape and that's it.
So, I can set an action to color and another action that "uncolors" if the shape is already colored... But when you drag the mouse to "uncolor", you'll end up coloring the neighboring shapes...
Whereas clicking doesn't interfere at all.
Moreover, your grouped shapes (for the islands) will need to be ungrouped for it to work. I haven't done that for now.
m@rina
- "On the office forum, we ask questions about office work..."
- "Really???"-
-
I am impressed by what you have managed to do in such a short time... which does not reassure me about my level (close to zero). Thank you again...
...However, the click principle does not meet the objective I pursue, which remains just user comfort:
given the number of departments, my idea was to highlight the departments when the mouse hovers over them to ensure that the user is sure they are on the desired department before clicking on the hyperlink that will take them to the relevant department slide with the desired information (I hope what I just wrote is understandable enough!).
I know, from having seen it on certain websites, that HTML can create this kind of effect, but now we are changing support and forum (And if my level in VBA is close to 0, my level in HTML is below -40).
Thanks again for the time you and "Varaldi Q" dedicated to me! -
-