目录

Type 属性

优质
小牛编辑
126浏览
2023-12-01

全部显示

Type 属性应用于 CommandBar 对象的情形。

返回命令栏的类型。MsoBarType 类型,只读。

MsoBarType 可以为下列 MsoBarType 常量之一。msoBarTypeMenuBarmsoBarTypeNormalmsoBarTypePopup

expression.Type

expression 必需。该表达式返回一个 CommandBar 对象。

Type 属性应用于 CommandBarButtonCommandBarComboBoxCommandBarControlCommandBarPopup 对象的情形。

返回命令栏控件的类型。MsoControlType 类型,只读。

MsoControlType 可以为下列 MsoControlType 常量之一。msoControlActiveXmsoControlAutoCompleteCombomsoControlButtonmsoControlButtonDropdownmsoControlButtonPopupmsoControlComboBoxmsoControlCustommsoControlDropdownmsoControlEditmsoControlExpandingGridmsoControlGaugemsoControlGenericDropdownmsoControlGraphicCombomsoControlGraphicDropdownmsoControlGraphicPopupmsoControlGridmsoControlLabelmsoControlLabelExmsoControlOCXDropdownmsoControlPanemsoControlPopupmsoControlSpinnermsoControlSplitButtonMRUPopupmsoControlSplitButtonPopupmsoControlSplitDropdownmsoControlSplitExpandingGridmsoControlWorkPane

expression.Type

expression 必需。该表达式返回上面对象之一。

Type 属性应用于 SearchScope 对象的情形。

返回对应于 SearchScope 对象类型的值。类型指定 FileSearch 对象的 Execute 方法进行文件搜索的区域。MsoSearchIn 类型,只读。

MsoSearchIn 可以为下列 MsoSearchIn 常量之一。msoSearchInCustommsoSearchInMyComputermsoSearchInMyNetworkPlacesmsoSearchInOutlook

expression.Type

expression 必需。该表达式返回一个 SearchScope 对象。

Type 属性应用于 DocumentProperty 对象的情形。

返回或设置文档属性类型。对于内置文档属性为只读,对于自定义文档属性为可读写。

expression.Type

expression 必需。该表达式返回一个 DocumentProperty 对象。

说明

返回值必须为 MsoDocProperties 常量。

MsoDocProperties 可以为下列 MsoDocProperties 常量之一。msoPropertyTypeBooleanmsoPropertyTypeDatemsoPropertyTypeFloatmsoPropertyTypeNumbermsoPropertyTypeString

示例

应用于 CommandBar 对象的情形。

本示例查找名为 Custom 的命令栏上的第一个控件。本示例使用Type 属性判断该控件是否为按钮。如果控件为按钮,本示例复制“常用”工具栏上“复制”按钮的表面并粘贴到控件。

Set oldCtrl = CommandBars("Custom").Controls(1)
If oldCtrl.Type = msoControlButton Then
 Set newCtrl = CommandBars.FindControl(Type:= _
 MsoControlButton, ID:= _
 CommandBars("Standard").Controls("Copy").ID)
 NewCtrl.CopyFace
 OldCtrl.PasteFace
End If

应用于 DocumentProperty 对象的情形。

本示例显示文档属性的名称、类型和值。必须向过程传递一个有效的DocumentProperty 对象。

Sub DisplayPropertyInfo(dp As DocumentProperty)
 MsgBox "value = " & dp.Value & Chr(13) & _
 "type = " & dp.Type & Chr(13) & _
 "name = " & dp.Name
End Sub