+ Reply to Thread
Results 1 to 5 of 5

Loading an image into Userform.Image and loss of image quality

  1. #1
    Registered User
    Join Date
    03-20-2020
    Location
    Poland
    MS-Off Ver
    2019
    Posts
    2

    Loading an image into Userform.Image and loss of image quality

    I have code that adds images from a selected folder to cells. Everything works, but not always - on two out of four computers it works, but on the other two it doesn't. What's going on with the non-working computer:

    When trying to rotate the image by 90?, it does not reload the rotated image into userform.image (it displays as if it were an empty shape) Additionally, is there a way to perform this operation without losing image quality, because later when I display the image in a Windows program by clicking on it in the cell, it is enlarged and the quality of the image is greatly reduced (hardly visible).

    There are two questions: How can I do this so that the image quality is better when displayed, and why doesn't this code work on all computers? sample file attached.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,528

    Re: Loading an image into Userform.Image and loss of image quality

    Image quality will be relative to original. If you make it bigger it will deteriorate.
    You can maybe make your originals bigger with a free program called Irfanview and maintain good quality or just make sure you get high quality pictures to start with.

    Don't know the answer to the question why it does not work on some computers.
    Experience trumps academics every day of the week and twice on Sunday.

  3. #3
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Re: Loading an image into Userform.Image and loss of image quality


    Maybe 'cause IE was removed from the computers …

  4. #4
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    2,224

    Re: Loading an image into Userform.Image and loss of image quality

    dareksg, I've arranged for you to rotate the image on each computer (at least I hope so ) using a different method than copying the chart. But keep in mind that the rotation occurs only in the UserForm, into the sheet the image is inserted in its original form.

    Consider whether the clicked image needs to be opened in an external program. Since you're storing images in the workbook, maybe zooming the image can also happen in the workbook. When you open an image in an external program, especially small images can be distorted because that program can zoom in to fill the entire screen (or at least a large part of it). Then the original pixels are enlarged, which ends up blurring the image. And you are unlikely to be able to control the scale of this zooming.
    If you choose to enlarge the image in the sheet, then you can control the magnification size yourself. For example, you click on the image and it zooms in 2 or 3 times (depending on what magnification scale you choose). Another click on that image (enlarged) should return it to a small size.

    Attention. The code is adapted to the 32-bit version of MS Office. For the 64-bit version, the winAPI function declarations must be adjusted accordingly.

    Artik
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    03-20-2020
    Location
    Poland
    MS-Off Ver
    2019
    Posts
    2

    Re: Loading an image into Userform.Image and loss of image quality

    Thank you Artik, for the neat proposal with the clipboard. Although adapting it to 64-bit scared me, it seems like I managed to adjust the code to the 64-bit version, and it works. As for the pictures, they have to be displayed like that, but I won't reduce their size too much, so as not to lose quality.

    Below I am sending the code that works for me on 32 and 64.

    Dzięki

    Please Login or Register  to view this content.

+ 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] Userform Image Control - Show specific region of Image
    By PrizeGotti in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 11-09-2021, 12:04 PM
  2. 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
  3. 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
  4. Replies: 1
    Last Post: 07-14-2016, 04:59 AM
  5. [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
  6. [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
  7. [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

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