Width 属性

       

对于 Frameset 对象:该属性返回或设置指定的 Frameset 对象的宽度。Long 类型,可读写。由 WidthType 属性决定该宽度值所用的度量单位的类型。

对于所有其他对象:该属性返回或设置指定对象的宽度,以磅为单位。Long 类型,可读写。

示例

本示例在新文档中创建一张 5x5 的表格,然后将第一个单元格的宽度设为 1.5 英寸。

Set newDoc = Documents.Add
Set myTable = _
    newDoc.Tables.Add(Range:=Selection.Range, NumRows:=5, _
    NumColumns:=5)
myTable.Cell(1, 1).Width = InchesToPoints(1.5)

本示例返回插入点所在的单元格宽度(以磅为单位)。

If Selection.Information(wdWithInTable) = True Then
    MsgBox PointsToInches(Selection.Cells(1).Width)
End If

本示例将包含所选内容的节的格式设置为三栏。For Each...Next 循环用于显示 TextColumns 集合中每一列的宽度。

Selection.PageSetup.TextColumns.SetCount NumColumns:=3
For Each acol In Selection.PageSetup.TextColumns
    MsgBox "Width= " & PointsToInches(acol.Width)
Next acol

本示例设置 Microsoft Word 应用窗口的宽度和高度。

With Application
    .WindowState = wdWindowStateNormal
    .Width = 500
    .Height = 400
End With

本示例设置指定 Frameset 对象的宽度为窗口宽度的 25%。

With ActiveWindow.ActivePane.Frameset
    .WidthType = wdFramesetSizeTypePercent
    .Width = 25
End With