Table of contents
Collapse the table of content
Expand the table of content

Shape.GetWidth Method (Publisher)

office 365 dev account|Last Updated: 8/24/2017
3 Contributors

Returns the width of the shape or shape range as a Single in the specified units.


expression. GetWidth( Unit)

_expression_A variable that represents a Shape object.


NameRequired/OptionalData TypeDescription
UnitRequiredPbUnitTypeThe units in which to return the width.

Return Value



The Unit parameter can be one of the PbUnitType constants declared in the Microsoft Publisher type library.

Use the GetHeight method to return the height of a shape or shape range.


The following example displays the height and width in inches (to the nearest hundredth) of the shape range consisting of all the shapes on the first page of the active publication.

With ActiveDocument.Pages(1).Shapes.Range 
 MsgBox "Height of all shapes: " _ 
 &; Format(.GetHeight(Unit:=pbUnitInch), "0.00") _ 
 &; " in" &; vbCr _ 
 &; "Width of all shapes: " _ 
 &; Format(.GetWidth(Unit:=pbUnitInch), "0.00") _ 
 &; " in" 
End With
© 2018 Microsoft