Outlook) (FormDescription.ScriptText 属性

返回一个 字符串 ,包含所有的 VBScript 代码在窗体的脚本编辑器。 此为只读属性。

语法

expressionScriptText

表达 一个代表“FormDescription”对象的变量。

示例

此Microsoft Visual Basic Scripting Edition (VBScript) 示例使用 Open 事件访问 MailItemHTMLBody 属性。 这会将 MailItem检查器的EditorType 属性设置为 olEditorHTML。 设置 MailItemBody 属性后, EditorType 属性将更改为默认值。 例如,如果默认电子邮件编辑器设置为 RTF, 则 EditorType 设置为 olEditorRTF。 如果此代码放在设计模式下的窗体的脚本编辑器中,运行时消息框会反映在 EditorType按窗体更改正文。 最后一个消息框使用 “脚本文本” 属性在脚本编辑器中显示所有 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

另请参阅

答复对象

支持和反馈

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