會傳回 String,此字串包含表單之 [指令碼編輯器] 中的所有 VBScript 程式碼。 唯讀。
語法
expression。 ScriptText
運算式 代表 'FormDescription' 物件的變數。
範例
此Microsoft Visual Basic Scripting Edition (VBScript) 範例使用 Open 事件存取 MailItem 的 HTMLBody 屬性。 這會將 MailItem 的檢查器的EditorType 屬性設定為 olEditorHTML。 設定 MailItem 的 Body 屬性時, 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 支援與意見反應。