+ Reply to Thread
Results 1 to 3 of 3

VBA/Macros mouse over to change an image

  1. #1
    Registered User
    Join Date
    01-27-2020
    Location
    Kansas City
    MS-Off Ver
    MS Office 360
    Posts
    1

    VBA/Macros mouse over to change an image

    I'm very new to using VBA in general and I cannot seem to find a way to create a mouse over command to make make an image change. I am familiar with the basic trick of using a comment and formating it. That is not what I want to do here.
    I want to hover the mouse over various cells or command buttons that display different regions around the world. I want the image to change so it looks like that region is highlighted when the mouse is over it.

    I've supplied images for North America as an example. You'll see when the mouse is over the North American cell the image changes. Extra points for getting the cell to glow when the mouse is over it.
    Of course, these are just screenshots I made to show what I'm trying to achieve here. Any assistance would be very appreciated.

    Excel document:
    Forum_Version.xlsx

    Screenshots of what I want to do:

    WorldMapTest.png

    NorthAmericaTest.png

    Supported PNG images to use for the document:

    WorldMap.png

    NorthAmerica.png

  2. #2
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,877

    Re: VBA/Macros mouse over to change an image

    There is no native event for triggering code when you hover over a cell.
    However, there is known hack, that makes use of UDF and Hyperlink function.
    While the article is old (and sample in 2nd link requires changing API call, if using 64 bit install of Office), I can confirm technique still works for Office 365.

    Have a read of following links.
    https://chandoo.org/wp/interactive-d...ng-hyperlinks/
    https://optionexplicitvba.blogspot.c...er-b8-ov1.html
    ?Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something.?
    ― Robert A. Heinlein

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

    Re: VBA/Macros mouse over to change an image

    You can add a activex label over the images in order to detect move position.

    The really hard part is determining which country the mouse position related to. You can use a simple box area approach but that may not be fine enough control.
    You will also need images of the country highlighted or not and toggle the visibility of that shape.

    See here for examples
    https://www.clearlyandsimply.com/cle...oft-excel.html
    Cheers
    Andy
    www.andypope.info

+ 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. Image Pop Up on Mouse Hover over image on userform
    By mc84excel in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-31-2019, 04:43 PM
  2. About the mouse over the image
    By Strsh in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-06-2018, 06:52 PM
  3. Replies: 0
    Last Post: 03-06-2013, 12:52 PM
  4. Show image on mouse over in another cell
    By kkostas in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-15-2012, 01:12 PM
  5. Replies: 1
    Last Post: 05-16-2011, 08:07 AM
  6. Image Popup when mouse arrow hovers on Button
    By ravinder_tigh in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-06-2009, 11:13 AM

Tags for this Thread

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