+ Reply to Thread
Results 1 to 5 of 5

Zoom in/on userform using mousewheel

  1. #1
    Registered User
    Join Date
    10-21-2019
    Location
    lugo
    MS-Off Ver
    2016
    Posts
    21

    Zoom in/on userform using mousewheel

    Today I was trying to look how to get zoom (in/on) a userForm with the mousewheel. The more I searched the less I found. So came to open a thread, and yesterday there was the post 1297548 on excelForum (excelforum.com/excel-programming-vba-macros/1297548-pan-on-a-zoomed-in-image-on-a-userform.html). Not the same, but similar, still not the solution to my issue. (zooming "on" is the same thing as you need to modify height/width/top/left values, zooming "in" is a little different, but similar code should).

    I could not use Andy Pope's approximation as I need the MouseUp and Down method for other purposes, but the mousewheel is there for no use. As I said, I have not found anything to solve the zoom issue so far.

    Not all the search time was wasted. I have not finished it, is just an idea in which I will be working late today, but I think this is on the good path:
    With the hook code on mrexcel forum board (mrexcel.com/board/threads/generic-mousewheel-scroll-for-userform-and-for-all-its-controls.961943/page-4), with the attachment app.box.com/s/189ehjeyrtbnb1uk1sq8xul5jz1xpicm, or this other solution in github from cristianbuse (github.com/cristianbuse/VBA-UserForm-MouseScroll) (sorry I have not enough "Karma" to post links) you can make a hook to any control (can focus on the scroll control type).

    If you place a (Not) Visible scroll control in the userform, you can link the hook to that control. Afterwards, you will only need to modify the ScrollBar1_Change method to control the userform.zoom property.

    Any other idea before I try is wellcome. I suppose that there should be a way to link the hook to the UserForm.Zoom property without the need of the scroll control, but I could not manage to do it (I don't know if possible)

    Kind regards
    Last edited by audeser; 11-26-2019 at 12:22 PM.

  2. #2
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Zoom in/on userform using mousewheel

    Hello audeser,

    Welcome to this Forum!

    Why don't you just use a "SpinButton" to zoom in or zoom out? It would be much easier.

    Regards.
    Please consider:

    Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

  3. #3
    Registered User
    Join Date
    10-21-2019
    Location
    lugo
    MS-Off Ver
    2016
    Posts
    21

    Re: Zoom in/on userform using mousewheel

    Thank you Winon,

    The thing is that I'm on an "Excel CAD" add-in, and a spin button is a bit weird for this task . I specifically need the mousewheel for this.

    So far I can draw polylines with the mouse (I'm posting my findings here: audeser.com/vba-draw-on-userform/ and in some older posts on my blog. Unfortunatelly, the older posts were killed by wordpress beautifier (code broken in several places, so are little functional to say anything), and I had a major information lost after I post the codes (I overwrite my backup with the corrupted data I was trying to save)... so I can not post them again so easily, but will do with time. To worsen things, I didn't know how to upload an Excel file to wordpress, so did not, lossing the add-in as it was a year ago because of the backup... no more crying. To this point I'm nearly at the beginning again with this thing, but I want to finish it this time.

    And zoom is a property that I have to achieve. Hope I could get resolved in one or two days... I can not imagine that nobody else had this "craving" so far.

    Kind regards

  4. #4
    Registered User
    Join Date
    03-27-2020
    Location
    London, UK
    MS-Off Ver
    2016
    Posts
    3

    Re: Zoom in/on userform using mousewheel

    Hi audeser,

    Thank you for posting a URL to my repository: link to personal site removed
    I might be a bit too late but I've commited a basic Zoom function. You just need to hold down the CTRL key and use the Mouse Wheel to scroll.

    Kind Regards
    Last edited by AliGW; 10-12-2023 at 06:27 AM.

  5. #5
    Registered User
    Join Date
    03-27-2020
    Location
    London, UK
    MS-Off Ver
    2016
    Posts
    3

    Re: Zoom in/on userform using mousewheel

    For anyone interested, the repository link to personal site removed now supports Modeless and Modal forms
    Last edited by AliGW; 10-12-2023 at 06:26 AM.

+ 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. [SOLVED] VBA Userform Zoom Problem
    By EssoExplJoe in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-14-2017, 09:48 AM
  2. Zoom plot in image control box present in the userform
    By HinaSha in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 05-04-2014, 12:26 AM
  3. Mousewheel-Scrolling in UserForm
    By Edwood in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-31-2012, 05:16 AM
  4. Setup mousewheel scroll
    By randell.graybill in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-04-2009, 10:15 PM
  5. mousewheel work on combobox
    By c.vaibhav in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-28-2009, 03:35 AM
  6. zoom userform
    By madhg in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-12-2009, 07:35 AM
  7. mousewheel not working in vba code window?
    By neowok in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-01-2005, 08:23 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