共用方式為


Outlook) (FormDescription.ScriptText 屬性

會傳回 String,此字串包含表單之 [指令碼編輯器] 中的所有 VBScript 程式碼。 唯讀。

語法

expressionScriptText

表達 代表 'FormDescription' 物件的變數。

範例

這個 Microsoft Visual Basic Scripting Edition (VBScript) 範例會使用Open事件來存取MailItemHTMLBody屬性。 這會將MailItemInspectorEditorType屬性設定為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

另請參閱

FormDescription 物件

支援和意見反應

有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應