+ Reply to Thread
Results 1 to 6 of 6

Maintain image size across different size displays

  1. #1
    Valued Forum Contributor
    Join Date
    12-02-2012
    Location
    Melbourne, VIC
    MS-Off Ver
    Excel 2016
    Posts
    750

    Maintain image size across different size displays

    I have a workbook set to print a photo report (sample attached). Photos Sample.xlsx
    • A VBA code inserts the images into the worksheet and re-sizes them to a height of 8.47cms, and centered across the merged cells of the image row.
    • The images may be of Landscape or Portrait orientation. Set to a height of 8.47 cms, both types perfectly align to the row height (320 pixels) irrespective of the their width. (The width is kept proportional to the height, so the images maintain their 'aspect ratio').
    • The other row height are also predefined, such that 10 rows print per A4 page. (i.e. 2 photos to a page).
    • Lastly, I need the images to be of 8.47cms height, irrespective of the pixel units, or any other units.
    All works fine on my display. However, when my colleague runs this on his PC, the images are not exactly aligned.

    I'm guessing this has something to do with pixels vs cms. Is someone able to point me to some good articles on the subject of how images are sized in excel so I may learn from it.

    The idea is to ensure that my images are always:
    • Sized to a height of 8.47cms. The width would adjust to whatever cms by maintaining the 'aspect ratio'.
    • Fit the row height, or rather that the row height should fit the image of height 8.47cms
    • Should happen across different size monitor displays. So that the report workbook can be freely shared/printed etc.. as desired.

    Thanks in advance.

  2. #2
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Maintain image size across different size displays

    See if using something like this to set the rowheight helps

    Please Login or Register  to view this content.

  3. #3
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Maintain image size across different size displays

    I suggest that you don't rely on the row or column sizes. Instead, insert the photographs, size them and arrange them as required. Put all the captions in Text Boxes. Select each photograph and text box that you want to align to the left and by holding down the SHIFT key and clicking in each photograph and text box that you want to align left. Click on Format Tab, Align Button and choose Align Left. All objects will snap to the same left alignment. Repeat for the right. Align each text box under the photographs as Align Top.

    Now, hold down the SHIFT key and select all the objects including those that are aligned to the left of the page and click on Format, Group and group all the objects. Now you can move the whole group of objects as a unit keeping their positions and sizes relative to each other as needed to get the output that you want. All rows and columns of the worksheet are not affected by this.

    I have included a couple of photographs to demonstrate.
    Attached Files Attached Files
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  4. #4
    Valued Forum Contributor
    Join Date
    12-02-2012
    Location
    Melbourne, VIC
    MS-Off Ver
    Excel 2016
    Posts
    750

    Re: Maintain image size across different size displays

    Mate,
    Thanks for finding time to help me. Your suggestion may work, but it would be very laborious (a typical photo report in my case has 100+ images). So, I'm definitely looking for a VBA based approach. (Apologies, I should have mentioned this earlier).

    Is there a VBA way to insert and position an image at a specified location of the page without referencing it to any row/column of the worksheet? (any code snippet that one could tweak). As I'd be printing this to A4, I know exactly where i want the image to be displayed (as in distance from the top and left of the page), and that position will not change between pages. I need the image to center to the page and be exactly of size 8.47 cms in height, whilst maintaining the aspect ratio, so the width may change.

    Also, I do need to use Excel for this, as there are many other worksheets in this report (which I have not shared) that have several calculations and inter-links.

  5. #5
    Valued Forum Contributor
    Join Date
    12-02-2012
    Location
    Melbourne, VIC
    MS-Off Ver
    Excel 2016
    Posts
    750

    Re: Maintain image size across different size displays

    Mate,
    Thanks for your suggestion. Prima facie, this should work. Will give it a crack and revert.

    However, I also want to understand how the row heights and column widths are assigned in Excel; and why would that change from one system to another. Are there application level or workbook level settings that affect these values? I'd like to learn this.

  6. #6
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Maintain image size across different size displays

    Row height is based on font size, so will vary with the resolution and size of the display.

    Change the font size of any cell (or range of cells) and the row height will automatically adjust to fit. Changing the height of any row (manually or with vba) will prevent this from happening unless autofit is subsequently applied to the row to 'reset' it.

    This doesn't affect column width which would imply that there is a different default parameter there, maybe based on the default font set at application level when the workbook was created.

+ 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 Auto-Size with VBA
    By Oilfield in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-27-2015, 07:36 AM
  2. 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
  3. Insert Images, scale to fit a cell size, maintain aspect ratio?
    By monet60707 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-27-2013, 02:02 PM
  4. pre defined image size
    By wee_willy in forum Excel General
    Replies: 0
    Last Post: 07-30-2012, 11:46 AM
  5. Reducing image file size
    By Queen Yell in forum Excel General
    Replies: 10
    Last Post: 08-04-2010, 07:57 AM
  6. Replies: 1
    Last Post: 02-19-2006, 11:40 AM
  7. File size when using background image?
    By JDThree [MVP] in forum Excel General
    Replies: 7
    Last Post: 05-24-2005, 06:32 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