WebOptions.PixelsPerInch property (Excel)

Returns or sets the density (pixels per inch) of graphics images and table cells on a webpage. The range of settings is usually from 19 to 480, and common settings for popular screen sizes are 72, 96, and 120. The default setting is 96. Read/write Long.

Syntax

expression.PixelsPerInch

expression A variable that represents a WebOptions object.

Remarks

This property determines the size of the images and cells on the specified webpage relative to the size of text whenever you view the saved document in a web browser. The physical dimensions of the resulting image or cell are the result of the original dimensions (in inches) multiplied by the number of pixels per inch.

You use the ScreenSize property to set the optimum screen size for the targeted web browsers.

Example

This example sets the pixel density depending on the target screen size of the browser. For 800x600 pixel screens, the density is 72 pixels per inch. For 1024x768 pixel screens, the density is 96 pixels per inch. For all other cases, use a density of 120 pixels per inch.

With ThisWorkbook.WebOptions 
 Select Case .ScreenSize 
 Case msoScreenSize800x600 
 .PixelsPerInch = 72 
 Case msoScreenSize1024x768 
 .PixelsPerInch = 96 
 Case Else 
 .PixelsPerInch = 120 
 End Select 
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.