+ Reply to Thread
Results 1 to 16 of 16

Mouse Over Effect - Is there a Macro available for that?

  1. #1
    Forum Contributor
    Join Date
    09-10-2008
    Location
    Phoenix, AZ
    MS-Off Ver
    Office 365
    Posts
    985

    Mouse Over Effect - Is there a Macro available for that?

    Hello All,

    I was wondering if there is a Macro available to produce a MouseOver effect?

    When the mouse passes over darker Picture 1, the lighter Picture 2 shows and when it is moved off of the lighter Picture 2, the Lighter Picture 2 is hidden showing Darker Picture 1

    Suggestions would be appreciated...

    Regards,

    John
    Last edited by JJFletcher; 09-23-2017 at 04:22 PM.

  2. #2
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Mouse Over Effect - Is there a Macro available for that?

    Not easily, you'd need a mouse enter and mouse leave. You could use mousemove for enter, but you'll struggle with leave

  3. #3
    Forum Contributor
    Join Date
    09-10-2008
    Location
    Phoenix, AZ
    MS-Off Ver
    Office 365
    Posts
    985

    Re: Mouse Over Effect - Is there a Macro available for that?

    I've given that solution some thought... Are there any samples of this available that you may know of?

    Regards

    John

  4. #4
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Mouse Over Effect - Is there a Macro available for that?

    No, it'll get complicated very quickly. I suspect you'd need windows apis to track the mouse, but that's not without issue - vba controls don't have handles like vb6 controls do. I think you'd need to get the dimensions of the control and calculate whether you're hovering on it from the windows pointer events.

  5. #5
    Forum Contributor
    Join Date
    09-10-2008
    Location
    Phoenix, AZ
    MS-Off Ver
    Office 365
    Posts
    985

    Re: Mouse Over Effect - Is there a Macro available for that?

    Thanks - I appreciate your input greatly

    Regards,

    John

  6. #6
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Mouse Over Effect - Is there a Macro available for that?

    There may be some mileage in putting a larger invisible control around the "hovered" control to fake the "mouse out" event, if the image is in a userform then you could look at the mousemove userform handler. TBH I think it would be unreliable, the speed of movement may cause the events not to fire

  7. #7
    Forum Contributor
    Join Date
    09-10-2008
    Location
    Phoenix, AZ
    MS-Off Ver
    Office 365
    Posts
    985

    Re: Mouse Over Effect - Is there a Macro available for that?

    Yes - I see... The images would be in the sheet and not the UserForm

    Regards,

    John

  8. #8
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Mouse Over Effect - Is there a Macro available for that?

    Eugh, activeX controls on worksheets are nasty - you want to avoid them.

    I'd look for another solution

  9. #9
    Forum Contributor
    Join Date
    09-10-2008
    Location
    Phoenix, AZ
    MS-Off Ver
    Office 365
    Posts
    985

    Re: Mouse Over Effect - Is there a Macro available for that?

    Thanks - I 've definitely been looking for solutions "lol"

  10. #10
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: Mouse Over Effect - Is there a Macro available for that?

    Are you able to make the hyperlink approach work

    http://optionexplicitvba.blogspot.co...-mini-faq.html
    Cheers
    Andy
    www.andypope.info

  11. #11
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: Mouse Over Effect - Is there a Macro available for that?

    .

    Ref Post #6 :

    A work around employed in a personal project was to place an invisible LABEL on each side of a control that was placed on a worksheet. Then using the MOUSEMOVE event, it was possible
    to have the control change colors depending on the position of the mouse; i.e., Grey when not hovering ... Red when hovering over.

    The process works very well here .. albeit, a workaround and not very elegant.

  12. #12
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Mouse Over Effect - Is there a Macro available for that?

    Maybe :
    Please Login or Register  to view this content.
    Attached Files Attached Files
    1. I care dog
    2. I am a loop maniac
    3. Forum rules link : Click here
    3.33. Don't forget to mark the thread as solved, this is important

  13. #13
    Forum Contributor
    Join Date
    09-10-2008
    Location
    Phoenix, AZ
    MS-Off Ver
    Office 365
    Posts
    985

    Re: Mouse Over Effect - Is there a Macro available for that?

    Hi Karedog,

    Thanks for the sample - I really appreciate this a lot...

    Taking the code from the Sheet and adding it to my existing sheet I notice that the images being used in you sample are connected to the sheet code - I am not able to get my sheet code to see the images that I am working with be seen in the sheet properties like you have in the sample

    Also I notice that
    Please Login or Register  to view this content.
    is being used in the Sheet Formula section

    Regards,

    John

  14. #14
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Mouse Over Effect - Is there a Macro available for that?

    Hi John,


    Quote Originally Posted by JJFletcher View Post
    Taking the code from the Sheet and adding it to my existing sheet I notice that the images being used in you sample are connected to the sheet code - I am not able to get my sheet code to see the images that I am working with be seen in the sheet properties like you have in the sample
    In my attached workbook, two "Image Controls's name" that I used are called "imgLight" and "imgDark".
    You must change the sheet code to reflect your actual Image's name on your worksheet.
    Or, if you want to use the code without modification, you must change the name property of your images to "imgLight" and "imgDark" (I think this is the better option).
    To change this, just make sure you are in "Design Mode", then right click on the Image Control --> Properties --> then change the (Name) property (the topmost one) to "imgLight" and "imgDark"
    If you have any difficulties doing this, please upload the workbook and I'll do it for you.




    Quote Originally Posted by JJFletcher View Post
    Also I notice that
    Please Login or Register  to view this content.
    is being used in the Sheet Formula section
    Yes, if you are in "Design Mode" and you click any Form Control on the sheet, the formula bar will display this text.
    Just exit "Design Mode", and this will not shown up.

  15. #15
    Forum Contributor
    Join Date
    09-10-2008
    Location
    Phoenix, AZ
    MS-Off Ver
    Office 365
    Posts
    985

    Re: Mouse Over Effect - Is there a Macro available for that?

    Hi Karedog,

    Outstanding code and thanks for giving me clarification... Works great!!! Actually does exactly what I want..

    I have 6 images which are horizontal like a menu and this is going to be a lot of code for those 6 images - will start modifying the code to accommodate the 6 dark and light images. We shall see

    Should be fun

    Thanks again

    Regards,

    John

  16. #16
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Mouse Over Effect - Is there a Macro available for that?

    Hi John, you are welcome.
    Thanks for marking the thread as solved and rep.points.

    Regards

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Mouse Hover Effect using VBA!!
    By meus in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-13-2015, 04:27 AM
  2. Strange effect of IF ELSE in my macro
    By kjg in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 07-19-2014, 12:26 PM
  3. getting a macro to effect all columns
    By TheBobot in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-19-2007, 12:20 PM
  4. Mouse over effect in excel sheet
    By prenesh in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-01-2007, 03:39 PM
  5. [SOLVED] Mouse over effect on autoshape
    By Mark Stephens in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 05-07-2005, 11:06 AM
  6. [SOLVED] Mouse over effect, anyone know how to do it?
    By Mark Stephens in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 05-04-2005, 09:06 AM
  7. [SOLVED] Mouse over effect on chart - anyone know how to do this?
    By Mark Stephens in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-01-2005, 11:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1