Fit picture to screen

Giordano Bruno

Well-known Member
Joined
Jan 7, 2007
Messages
1,356
I have an image called Picture1 and I want it to fit the size of any screen. The aspect ratio is > 2:1 so I guess that some of the right hand side of the picture will not be visible. I can get the screen size and also the picture size, but when I try to adjust them, the calculation doesn't stack up.

Selection.ShapeRange.Width give the width of the picture as 1120. GetSystemMetrics (SM_CXSCREEN) gives the width of the screen as 2736 yet the picture is larger than the screen. Does anyone have an explanation?
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
I have an image called Picture1 and I want it to fit the size of any screen...

...I can get the screen size and also the picture size,...

I may be wrong for presuming this, but are we talking about an image plunked/embedded onto a worksheet? If so, what window are we measuring to see how big the picture should be? Are we assuming that the worksheet/workbook and application's main window are maximized?

...Selection.ShapeRange.Width give the width of the picture as 1120. GetSystemMetrics (SM_CXSCREEN) gives the width of the screen as 2736 yet the picture is larger than the screen. Does anyone have an explanation?

Selection.ShapeRange.Width returns in Points; GetSystemMetrics (SM_CXSCREEN) returns the Width in Pixels.
 
Upvote 0
Hi GTO. Yes, the image exists on the workbook and the excel sheet window is maximized. Note that this is not a small difference .

The problem is complicated by the need to move the image after it has been resized as I have another image that needs to be centred on the screen, but one thing at a time.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,176
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top