Outlook) (Application.CreateItem 方法

建立並傳回新的 Microsoft Outlook 專案。

語法

expressionCreateItem( _ItemType_ )

expression 代表 Application 物件的變數。

參數

名稱 必要/選用 資料類型 描述
ItemType 必要 OlItemType 新項目的 Outlook 項目類型。

傳回值

代表新 Outlook 專案的 Object 值。

註解

CreateItem 方法只能建立預設的 Outlook 項目。 若要使用自訂表單建立新專案,請使用Items集合上的Add方法。

範例

下列 Microsoft Visual Basic for Applications (VBA) 範例會建立新的 MailItem 物件,並將 BodyFormat 屬性設定為 olFormatHTML。 電子郵件專案的本文現在會以 HTML 格式顯示。

Sub CreateHTMLMail() 
 
 'Creates a new email item and modifies its properties 
 
 Dim objMail As Outlook.MailItem 
 
 
 
 'Create email item 
 
 Set objMail = Application.CreateItem(olMailItem) 
 
 With objMail 
 
 'Set body format to HTML 
 
 .BodyFormat = olFormatHTML 
 
 .HTMLBody = "<HTML><H2>The body of this message will appear in HTML.</H2><BODY> Please enter the message text here. </BODY></HTML>" 
 
 .Display 
 
 End With 
 
End Sub

另請參閱

Application 物件

如何:將約會 XML 資料匯入 Outlook 約會物件

支援和意見反應

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