Window.PointsToScreenPixelsX method (Excel)

Converts a horizontal measurement from points (document coordinates) to screen pixels (screen coordinates). Returns the converted measurement as a Long value.

Syntax

expression.PointsToScreenPixelsX (Points)

expression A variable that represents a Window object.

Parameters

Name Required/Optional Data type Description
Points Required Long The number of points horizontally along the top of the document window, starting from the left.

Return value

Long

Example

This example determines the height and width (in pixels) of the selected cells in the active window and returns the values in the lWinWidth and lWinHeight variables.

With ActiveWindow 
 lWinWidth = _ 
 .PointsToScreenPixelsX(.Selection.Width) 
 lWinHeight = _ 
 .PointsToScreenPixelsY(.Selection.Height) 
End With

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.