FormDescription.ScriptText プロパティ (Outlook)

フォームのスクリプト エディター内のすべての VBScript コードを含む 文字列 を返します。 読み取り専用です。

構文

expression。 ScriptText

式 'FormDescription' オブジェクトを表す変数。

例

この Microsoft Visual Basic Scripting Edition (VBScript) の例では、Open イベントを使用してメール アイテムの 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

関連項目

FormDescription オブジェクト

サポートとフィードバック

Office VBA またはこの説明書に関するご質問やフィードバックがありますか? サポートの受け方およびフィードバックをお寄せいただく方法のガイダンスについては、Office VBA のサポートおよびフィードバックを参照してください。