CreateItem 方法 (Outlook)Application.CreateItem method (Outlook)

创建并返回一个新的 Microsoft Outlook 项目。Creates and returns a new Microsoft Outlook item.

语法Syntax

expressionexpression. CreateItem( _ItemType_ )

expression:表示“Application”对象的变量。expression A variable that represents an Application object.

参数Parameters

名称Name 必需/可选Required/Optional 数据类型Data type 说明Description
ItemTypeItemType 必需Required OlItemTypeOlItemType 新项 Outlook 项目类型。The Outlook item type for the new item.

返回值Return value

一个代表新 Outlook 项目的Object值。An Object value that represents the new Outlook item.

说明Remarks

CreateItem方法只能创建默认的 Outlook 项目。The CreateItem method can only create default Outlook items. 若要创建使用自定义窗体的新项目,使用对 集合的 Add 方法。To create new items using a custom form, use the Add method on the Items collection.

示例Example

下面的 Microsoft Visual Basic for Applications (VBA) 示例创建一个新的**MailItem** 对象, 并将BodyFormat属性设置为olFormatHTMLThe following Microsoft Visual Basic for Applications (VBA) example creates a new MailItem object and sets the BodyFormat property to olFormatHTML. 此时, 电子邮件项目的正文文本将以 HTML 格式显示。The Body text of the email item will now appear in HTML format.

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

另请参阅See also

Application 对象Application Object

如何: 约会 XML 数据导入到 Outlook 约会对象How to: Import Appointment XML Data into Outlook Appointment Objects

支持和反馈Support and feedback

有关于 Office VBA 或本文档的疑问或反馈?Have questions or feedback about Office VBA or this documentation? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.