Conversion pixels to cm PROBLEM

Guido Meng

New Member
Joined
Oct 11, 2008
Messages
38
Hi...

I've been trying to build a code that draws a series of rectangles with different widths and lengths based on the contents in a range of cells. The code works but the problem is that although I used the Application.CentimeterstoPixels method, when I print the drawing, there is a noticeble discrepancy (about 5-6%) in the length of the lines. I think that this might have to do with taking into account the screen resolution but I don't know for sure.

Can anyone please illuminate me on this?

Thanks.....
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Hi Guido,

I'm not an expert on this subject, but I believe the problem is that the CentimeterstoPixels property has to do with how it displays on your monitor, not how it will print. Your display will stretch x and y disproportionally depending on your display dimensions and your video card display setting (e.g., a 1280 x 1024 display setting on a 17" x 10.5" monitor would result in the x dimension having to be stretched considerably to fit the screen.

However, screen pixels have no bearing on the printing. If you want a rectangle to print at 2"' x 3", you should make it 2" x 3" in the rectangle's size properties, not on the screen.

I hope this helps.

Keep Excelling.

Damon
 
Upvote 0
When you specify object dimensions with code you use 'points' - the conversion method is CentimetersToPoints

A point is 1/72 of an inch.

to make a shape 5 cm high you would use code like:

Code:
Shp.Height = Application.CentimetersToPoints(5)
 
Upvote 0

Forum statistics

Threads
1,215,046
Messages
6,122,854
Members
449,096
Latest member
Erald

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