Width Property
Applies To
Application object, Cell object, Cells collection object, Column object, Columns collection object, CustomLabel object, Frame object, InlineShape object, Shape object, ShapeRange collection object, Task object, TextColumn object, TextColumns collection object, TextInput object, Window object.
Description
Returns or sets the width of the specified object, in points. Read/write Long.
See Also
DistributeWidth method, Height property, HeightRule property, Left property, Resize method, SetWidth method, Spacing property, Top property, WidthRule property.
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 Word application window.
With Application
.WindowState = wdWindowStateNormal
.Width = 500
.Height = 400
End With