ShapeRange.GetWidth method (Publisher)

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

Syntax

expression.GetWidth (Unit)

expression A variable that represents a ShapeRange object.

Parameters

Name Required/Optional Data type Description
Unit Required PbUnitType The units in which to return the width. Can be one of the PbUnitType constants declared in the Microsoft Publisher type library.

Return value

Single

Remarks

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

Example

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

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.