+ Reply to Thread
Results 1 to 7 of 7

Image Pop Up on Mouse Hover over image on userform

  1. #1
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Lightbulb Image Pop Up on Mouse Hover over image on userform

    So I have this form containing multiple images for user selection. The images are shrunk down to enable the user a quick overview of the types of images. What I want to achieve is - when the end user hovers over any of these images/frames - a modeless userform will pop up displaying a much larger version of the same image.

    This alone would be challenging enough but there are some other points I want to look at:
    1. The popup form must be modeless. If the user moves the mouse away on the original form, the popup form must close. = PARTLY WORKING (DOUBT THIS CAN BE FULLY IMPLEMENTED). I initially tried measuring the mouse pointer in relation to the form but it had a lot of problems. So I was forced to call a sub from the mouse hover function of each control. The problem I have found is that the mouse hover function only works if the control is uppermost. Meaning if the popup form covers the control on the original form, the mouse movement is only read from the 2nd form not the 1st. Am chalking it up to a VBA technical limitation and moving on.
    2. If the user closes the original form, the popup form must close also. = PARTLY WORKING. I feel as though I am repeating code unnecessarily. I would like a single exit point but am not sure where this would go. Also sometimes the popup gets stuck but that
      is an issue with objective 4.
    3. The original form has dynamic size/positioning of images/frames. Not sure how this will play out with the 'mouse hover over image' code? = PARTLY WORKING. The popup matches the aspect ratio of the original image but I would like it to resize to most of the desktop area. I need to merge the 'resize form based on picture' concept from an earlier form (frmShowPicture) with the 'almost fill desktop area' concept used in frmShow10Pictures.
    4. Optional but nice to have - the pop up form should auto close after X seconds. = PARTLY WORKING. Occasionally the popup form insists on finishing its loop even after it has received the instruction to exit. I don't know why. Thinking I should open a separate thread to tackle this particular side issue.

    I don't expect to achieve all of these at the first attempt. But help on any of these aspects would be appreciated.
    Attached Files Attached Files
    Last edited by mc84excel; 03-31-2019 at 05:00 PM. Reason: Upload extract for testing and update progress
    *******************************************************

    HELP WANTED! (Links to Forum threads)
    Trying to create reusable code for Custom Events at Workbook (not Application) level

    *******************************************************

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

    Re: Image Pop Up on Mouse Hover over image on userform

    .
    Presuming your images display in an Image1 Control on the first UserForm .. this macro will display a UserForm2 on which you can add
    another Image Control and code to display the image any size you desire.

    Note: both form must be Non-Modal and the macro goes inside the UserForm1 code area.

    Please Login or Register  to view this content.

  3. #3
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,904

    Re: Image Pop Up on Mouse Hover over image on userform

    To take it a step further.
    Please Login or Register  to view this content.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  4. #4
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Re: Image Pop Up on Mouse Hover over image on userform

    Thanks Logit. I gave this a quick test and it looks promising.

    It also appears that my fears on point 3 were groundless. (I'm triggering the mouse hover event based on the frame that holds the picture)

    Anybody have any suggestions for points 1, 2 or 4 in my OP?

  5. #5
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Re: Image Pop Up on Mouse Hover over image on userform

    Thanks bakerman2, I will test this out and let you know how it works for me.

  6. #6
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,904

    Re: Image Pop Up on Mouse Hover over image on userform

    Point 1.

    I used the Userform_Click event on Userform1 to close Userform2.

    Point 2. In Userform1 code module.

    Please Login or Register  to view this content.
    Point 3.

    See code in Post#3 PictureSizeMode.

  7. #7
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Re: Image Pop Up on Mouse Hover over image on userform

    Thanks bakerman2

    I have been working on this but some goals are not fully met. If anybody else wants to help out, I am attaching a workbook (being an extract of the project) and an updated status on the objectives in the opening post.

+ 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. Inserting image into userform label, text behind image?!?!
    By spyrule in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 0
    Last Post: 08-31-2016, 03:23 PM
  2. Replies: 1
    Last Post: 07-14-2016, 04:59 AM
  3. [SOLVED] Using a Userform to Browse image file then paste selected image to sheet?
    By matrixpom in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-05-2015, 05:42 PM
  4. [SOLVED] How to apply Image borders to an image that my excel vba userform pastes in a word doc?
    By CaptainCool in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-11-2014, 05:40 PM
  5. [SOLVED] VBA to transfer image FROM userform image control TO a worksheet cell
    By Zoediak in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-01-2014, 02:51 PM
  6. Replies: 3
    Last Post: 01-06-2010, 02:16 PM
  7. How to add hover tips to image buttons?
    By PeteTheTool in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-21-2009, 11:54 PM

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