Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Mouseover with two VBA events

452 views
Skip to first unread message

pfx

unread,
Jun 15, 2006, 1:07:01 AM6/15/06
to
Hi Steve,

I hope you don't mind me raising the topic again but I was hoping to find
out if my query relating to mouseovers was first of all 'doable' and secondly
if I could borrow some of your time in achieving a solution.

You will remember resolving my first query in getting a mouseover event to
swap text regardles of being on a master or presentation slide.

The followup to this is setting up a highlight on the button that stays
active while the mouse hovers over the button rather than quickly switching
off in the default PowerPoint fashion.

I know you provided a solution for this but I was hoping this VBA script
could be combined with the swap text VBA solution as PowerPoint only allows
for one mouseover event at a time.

The original VBA script was:

Sub DisplayMessage(oShp As Shape)
' The shape's. Parent will be either the slide or master ' it's on; this way
you don't have to worry which
With oShp.Parent.Shapes("Slide Navigator").TextFrame.TextRange
.Text = oShp.Name DoEvents
End With
End Sub

And the most recent script is:

Sub HighlightMe(oSh As Shape)
oSh.Fill.ForeColor.RGB = RGB(255, 255, 0)
' make it yellow ' and give it a name so we can grab it later
oSh.Name = "CatchMeIfYouCan"
End Sub

Sub RemoveHighlight(oSh As Shape)
Dim oSl As Slide
Set oSl = oSh.Parent
' grab the highlighted shape
On Error Resume Next
With oSl.Shapes("CatchMeIfYouCan")
.Fill.ForeColor.RGB = RGB(0, 0, 255)
' Rename it something random
Randomize
.Name = CStr(Rnd())
End With
End Sub


I've had a crack at combining the two into one consolidated VBA script but
without success.

I would really appreciate your assistance if you have the time.

Thanks

PFX

Steve Rindsberg

unread,
Jun 15, 2006, 11:39:24 AM6/15/06
to
In article <E132F4B6-7406-4AFA...@microsoft.com>, Pfx wrote:
> Hi Steve,

Hi ... saw your other post and have it marked for when I get a few more minutes
to think about it; haven't had that so far, sorry!

>
> I hope you don't mind me raising the topic again but I was hoping to find
> out if my query relating to mouseovers was first of all 'doable' and secondly
> if I could borrow some of your time in achieving a solution.
>
> You will remember resolving my first query in getting a mouseover event to
> swap text regardles of being on a master or presentation slide.
>
> The followup to this is setting up a highlight on the button that stays
> active while the mouse hovers over the button rather than quickly switching
> off in the default PowerPoint fashion.
>
> I know you provided a solution for this but I was hoping this VBA script
> could be combined with the swap text VBA solution as PowerPoint only allows
> for one mouseover event at a time.
>
> The original VBA script was:
>
> Sub DisplayMessage(oShp As Shape)
> ' The shape's. Parent will be either the slide or master ' it's on; this way
> you don't have to worry which
> With oShp.Parent.Shapes("Slide Navigator").TextFrame.TextRange

> ..Text = oShp.Name DoEvents

> End With
> End Sub
>
> And the most recent script is:
>
> Sub HighlightMe(oSh As Shape)
> oSh.Fill.ForeColor.RGB = RGB(255, 255, 0)
> ' make it yellow ' and give it a name so we can grab it later
> oSh.Name = "CatchMeIfYouCan"
> End Sub
>
> Sub RemoveHighlight(oSh As Shape)
> Dim oSl As Slide
> Set oSl = oSh.Parent
> ' grab the highlighted shape
> On Error Resume Next
> With oSl.Shapes("CatchMeIfYouCan")

> ..Fill.ForeColor.RGB = RGB(0, 0, 255)

> ' Rename it something random
> Randomize

> ..Name = CStr(Rnd())

> End With
> End Sub
>
> I've had a crack at combining the two into one consolidated VBA script but
> without success.
>
> I would really appreciate your assistance if you have the time.
>
> Thanks
>
> PFX
>

-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================


pfx

unread,
Jun 15, 2006, 9:23:01 PM6/15/06
to
Hi Steve,
Thanks for getting back to me.
Whenever you've got some time to have a look at it would be great.
Regards
Chris

pfx

unread,
Jun 22, 2006, 9:50:01 PM6/22/06
to
Hi Steve,

Just wondering if you've had a chance to have a look at my query. I
appreciate that you're giving your time freely.
I understand that this query requires a little more investigation than usual.
There is another part to it that may or may not have an easier/more
immediate solution.
Is it possible for the mouseover event to trigger not only the swapping of
text in another box but also swapping of an image in a second location. As
the mouse passes over a button, a picture appears in a separate location and
the text describing the picture also appears in a separate box.
Hope this is possible either with or without the button highlight in my
query below.
If the above is not immediately possible it would be good to know the code
for mouseover - swap image, as against the code for mouseover - swap text as
you have already provided. If you have a VBA in PowerPoint book, I'll buy it!
My followup query is prompted by a closing deadline for this (major) project.
Thanks for your time and responses.
Chris

David M. Marcovitz

unread,
Jun 23, 2006, 10:48:43 AM6/23/06
to
On my Web site, I have added a mouse over "swapping event." Actually, it
doesn't involve swapping, but it easily could. I simply have one picture
cover up another one (as an example of a hover button). Just go to my Web
site:

http://www.PowerfulPowerPoint.com/

Click on "More Tricks" and look for Trick #10.

As for your question about having one mouse over do two things, that is
the beauty of VBA. A mouse over will only run one macro, but that macro
can do as many things as you want (including calling other macros).

As far as books go, unfortunately, there aren't a lot of choices. There
is only one book that really focuses on VBA and PowerPoint. It's not
complete and comprehensive, but it works for beginners to get started
writing macros like the ones you are describing. The examples on my site
under "Examples by Chapter" are from the book. The book contains
descriptions of how the examples work, so if you like what you see on the
site, then click on "Buy the Book."

--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/

=?Utf-8?B?cGZ4?= <p...@discussions.microsoft.com> wrote in
news:F36C7EA4-037A-49AD...@microsoft.com:

Steve Rindsberg

unread,
Jun 23, 2006, 4:22:26 PM6/23/06
to
In article <F36C7EA4-037A-49AD...@microsoft.com>, Pfx wrote:
> Hi Steve,
>
> Just wondering if you've had a chance to have a look at my query. I
> appreciate that you're giving your time freely.
> I understand that this query requires a little more investigation than usual.
> There is another part to it that may or may not have an easier/more
> immediate solution.
> Is it possible for the mouseover event to trigger not only the swapping of
> text in another box but also swapping of an image in a second location. As
> the mouse passes over a button, a picture appears in a separate location and
> the text describing the picture also appears in a separate box.
> Hope this is possible either with or without the button highlight in my
> query below.

It should be, so long as the mouseover triggers a macro. The macro can do pretty much
whatever you need it to.

0 new messages