Width Property
Frameset object: Returns or sets the width of the specified Frameset object. Read/write Long. The WidthType property determines the type of unit in which this value is expressed.
Page object: The Top and Left properties of the Page object always return 0 (zero) indicating the upper left corner of the page. The Height and Width properties return the height and width in points (72 points = 1 inch) of the paper size specified in the Page Setup dialog or through the PageSetup object. For example, for an 8-1/2 by 11 inch page in portrait mode, the Height property returns 792 and the Width property returns 612. All four of these properties are read-only.
All other objects: Returns or sets the width of the specified object, in points. Read/write Long.
Example
This example creates a 5x5 table in a new document and then sets the width of the first cell to 1.5 inches.
Set newDoc = Documents.Add
Set myTable = _
newDoc.Tables.Add(Range:=Selection.Range, NumRows:=5, _
NumColumns:=5)
myTable.Cell(1, 1).Width = InchesToPoints(1.5)
This example returns the width (in inches) of the cell that contains the insertion point.
If Selection.Information(wdWithInTable) = True Then
MsgBox PointsToInches(Selection.Cells(1).Width)
End If
This example formats the section that includes the selection as three columns. The For Each...Next loop is used to display the width of each column in the TextColumns collection.
Selection.PageSetup.TextColumns.SetCount NumColumns:=3
For Each acol In Selection.PageSetup.TextColumns
MsgBox "Width= " & PointsToInches(acol.Width)
Next acol
This example sets the width and height of the Microsoft Word application window.
With Application
.WindowState = wdWindowStateNormal
.Width = 500
.Height = 400
End With
This example sets the width of the specified Frameset object to 25% of the window width.
With ActiveWindow.ActivePane.Frameset
.WidthType = wdFramesetSizeTypePercent
.Width = 25
End With
Applies to | Application Object | Cell Object | Cells Collection Object | Column Object | Columns Collection Object | CustomLabel Object | Frame Object | Frameset Object | InlineShape Object | Line Object | Page Object | Rectangle Object | Shape Object | ShapeRange Collection Object | Task Object | TextColumn Object | TextColumns Collection Object | TextInput Object | Window Object
See Also | DistributeWidth Method | Height Property | HeightRule Property | Left Property | PercentWidth Property | Resize Method | SetWidth Method | Spacing Property | Top Property | WidthRule Property | WidthType Property