返回编辑器的类型。OlEditorType 常量,只读。
OlEditorType 可为以下 OlEditorType 常量之一。 |
olEditorHTML |
olEditorRTF |
olEditorText |
olEditorWord |
注意 如果仅访问了该项目的 Body 属性(如在 MsgBox myItem.Body
中),那么 EditorType 属性将不受影响。但如果重新设置了 Body 属性(如在 myItem.Body = "This is a new body"
中),那么 EditorType 将还原为用户默认的编辑器。
expression.EditorType
expression 必选。该表达式返回 Inspector 对象。
本 VBScript 示例使用 Open 事件来访问项目的 HTMLBody 属性。这将项目的 Inspector 对象的 EditorType 属性设置为 olEditorHTML。当设置项目的 Body 属性后,EditorType 属性将更改为默认值。例如,如果默认编辑器为 RTF,那么 EditorType 将设置为 olEditorRTF。
如果在设计模式下将代码放置到窗体的脚本编辑器中,那么在运行时如果窗体正文发生变化,消息框将反映 EditorType 中的变化。最终的消息框利用 ScriptText 属性显示脚本编辑器中的所有 VBScript 代码。
Function Item_Open()
'Set the HTMLBody of the item.
Item.HTMLBody = "<HTML><H2>My HTML page.</H2><BODY>My body.</BODY></HTML>"
'Item displays HTML message.
Item.Display
'MsgBox shows EditorType is 2.
MsgBox "HTMLBody EditorType is " & Item.GetInspector.EditorType
'Access the Body and show
'the text of the Body.
MsgBox "This is the Body: " & Item.Body
'After accessing, EditorType
'is still 2.
MsgBox "After accessing, the EditorType is " & Item.GetInspector.EditorType
'Set the item's Body property.
Item.Body = "Back to default body."
'After setting, EditorType is
'now back to the default.
MsgBox "After setting, the EditorType is " & Item.GetInspector.EditorType
'Access the items's
'FormDescription object.
Set myForm = Item.FormDescription
'Display all the code
'in the Script Editor.
MsgBox myForm.ScriptText
End Function