自动回复注释、电子邮件正文并添加抄送
Auto Reply with notes, email body and add CC
我正在尝试抄送第二人称,但出现错误 运行-time 13 Type mismatch
.
Option Explicit
'// Auto Replay with notes and email body- run Action Script
Public Sub ReplywithNote(Item As Outlook.MailItem)
Dim olInspector As Outlook.Inspector
Dim olDocument As Word.Document
Dim olSelection As Word.Selection
Dim olReply As MailItem
Dim olRecipient As Outlook.Recipient
Set olReply = Item.ReplyAll
olReply.Display
Set olRecipient = myItem.Recipient.Add("omar")
olRecipient.Type = olCC
Set olInspector = Application.ActiveInspector()
Set olDocument = olInspector.WordEditor
Set olSelection = olDocument.Application.Selection
olSelection.InsertBefore "Received, Thank you."
'// Uncomment to send
olReply.Send
End Sub
谢谢。
Recipients 的 Add 方法 class 在 Recipients 集合中创建了一个新的收件人。参数为收件人姓名;它可以是表示收件人的显示名称、别名或完整 SMTP 电子邮件地址的字符串。
如果您 运行 在 Outlook 中使用以下示例代码,则无需创建新的应用程序实例,请使用 VBA 中开箱即用的应用程序 属性。
Set myOlApp = CreateObject("Outlook.Application") // Application
Set myItem = myOlApp.CreateItem(olMailItem)
Set myRecipient = myItem.Recipients.Add ("Jon Grande")
myRecipient.Type = olCC
不要忘记在添加新收件人后调用 Recipient class 的 Resolve 方法。或者只是 Recipients class 的 ResolveAll 方法来根据地址簿解析收件人。
有关详细信息,请参阅 How to: Specify Different Recipient Types for a Mail Item。
尝试收件人而不是收件人
Dim olRecipient As Outlook.Recipient
我正在尝试抄送第二人称,但出现错误 运行-time 13 Type mismatch
.
Option Explicit
'// Auto Replay with notes and email body- run Action Script
Public Sub ReplywithNote(Item As Outlook.MailItem)
Dim olInspector As Outlook.Inspector
Dim olDocument As Word.Document
Dim olSelection As Word.Selection
Dim olReply As MailItem
Dim olRecipient As Outlook.Recipient
Set olReply = Item.ReplyAll
olReply.Display
Set olRecipient = myItem.Recipient.Add("omar")
olRecipient.Type = olCC
Set olInspector = Application.ActiveInspector()
Set olDocument = olInspector.WordEditor
Set olSelection = olDocument.Application.Selection
olSelection.InsertBefore "Received, Thank you."
'// Uncomment to send
olReply.Send
End Sub
谢谢。
Recipients 的 Add 方法 class 在 Recipients 集合中创建了一个新的收件人。参数为收件人姓名;它可以是表示收件人的显示名称、别名或完整 SMTP 电子邮件地址的字符串。
如果您 运行 在 Outlook 中使用以下示例代码,则无需创建新的应用程序实例,请使用 VBA 中开箱即用的应用程序 属性。
Set myOlApp = CreateObject("Outlook.Application") // Application
Set myItem = myOlApp.CreateItem(olMailItem)
Set myRecipient = myItem.Recipients.Add ("Jon Grande")
myRecipient.Type = olCC
不要忘记在添加新收件人后调用 Recipient class 的 Resolve 方法。或者只是 Recipients class 的 ResolveAll 方法来根据地址簿解析收件人。
有关详细信息,请参阅 How to: Specify Different Recipient Types for a Mail Item。
尝试收件人而不是收件人
Dim olRecipient As Outlook.Recipient