FormDescription.ScriptText プロパティ (Outlook)

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

構文

ScriptText

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

この Microsoft Visual Basic Scripting Edition (VBScript) の例では、Open イベントを使用して MailItemHTMLBody プロパティにアクセスします。 これにより、MailItemインスペクターEditorType プロパティが olEditorHTML に設定されます。 MailItemBody プロパティを設定すると、EditorType プロパティが既定値に変更されます。 たとえば、既定の電子メール エディターが RTF に設定されている場合、 EditorTypeolEditorRTF に設定されます。 デザイン モードでフォームのスクリプト エディターで次のコードを配置すると、実行時にメッセージ ボックスは、フォームの本文として EditorTypeの変更が反映されます。 最後のメッセージ ボックスでは 、Script Text プロパティを使用して、スクリプト エディターのすべての 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 のサポートおよびフィードバックを参照してください。