Shape.GetWidth 方法 (Publisher)

作为一个 单一 以指定单位返回形状或形状范围的宽度。

语法

表达式GetWidth (单元)

表达 一个代表 Shape 对象的变量。

参数

名称 必需/可选 数据类型 说明
Unit 必需 PbUnitType 返回宽度所使用的单位。 可以是 Microsoft Publisher 类型库中声明的 PbUnitType 常量之一。

返回值

单精度

备注

使用 GetHeight 方法可返回形状或形状范围的高度。

示例

以下示例按英寸(精确到百分位)显示形状范围的高度和宽度,该形状范围包含当前出版物的第一页上的所有形状。

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

支持和反馈

有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。