+ Reply to Thread
Results 1 to 4 of 4

Using vba to insert image - keep original size

  1. #1
    Registered User
    Join Date
    10-15-2018
    Location
    Denmark
    MS-Off Ver
    10
    Posts
    14

    Using vba to insert image - keep original size

    Hi,

    I have a problem - I am using this code to add a picture via a dialog box, it inserts my picture in my defined are, but distorts the image:

    Please Login or Register  to view this content.
    How can i maintain the original aspect ratio of the image in my existing code?

    Thanks!

  2. #2
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,903

    Re: Using vba to insert image - keep original size

    Pass -1 as the value for height and width.
    Rory

  3. #3
    Registered User
    Join Date
    10-15-2018
    Location
    Denmark
    MS-Off Ver
    10
    Posts
    14

    Re: Using vba to insert image - keep original size

    Thanks rorya!
    Is there any way to keep the aspect ration, but define a size as well?
    Cause the original size is so big, you need to zoom out in order to change size.

  4. #4
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,903

    Re: Using vba to insert image - keep original size

    Yes. Assuming you don't know the aspect ratio to begin with, just use -1 to insert, lock the aspect ratio, then resize it. The Shape obejct has a LockAspectRatio property for this.

+ 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] Insert the first image found with image search (e.g google) with criteria taken from cell.
    By themob212 in forum Excel Programming / VBA / Macros
    Replies: 31
    Last Post: 04-14-2021, 12:29 PM
  2. [SOLVED] Help resizing image - produces different image size on different computers.
    By Andrew Entee in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-18-2017, 01:47 PM
  3. Insert Image With Image Filename In Another Cell - Excel
    By Angelq117 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-17-2016, 09:38 AM
  4. Maintain image size across different size displays
    By jewelsharma in forum Excel General
    Replies: 5
    Last Post: 12-29-2015, 09:01 AM
  5. VBA to insert a photo into merged cells or shape and compress image size
    By nwb in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-25-2014, 03:10 AM
  6. Fix the image size for all image in cell
    By ganeshkumar in forum Excel General
    Replies: 5
    Last Post: 02-20-2014, 08:23 AM
  7. Insert image with move and size with cells
    By CocoriCoy in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-12-2012, 12:41 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