我正在尝试找出撤回邮件的数据类型在Outlook中包含什么。
定义邮件项时,不包括任何撤回的消息,因为它们不被视为邮件项。下面是声明邮件项变量的代码行
Dim msg As Outlook.MailItem 有谁知道声明召回消息的正确方法是什么?
发布于 2015-10-16 11:30:41
要撤回已发送的邮件-选择已发送文件夹中的电子邮件,然后运行以下vba。
Option Explicit
Sub Recall()
Dim SendItem As Object
Dim olItem As Outlook.MailItem
Dim olInsp As Outlook.Inspector
'// Selected item in Sent Items folder
Set SendItem = ActiveExplorer.Selection.Item(1)
If TypeName(SendItem) = "MailItem" Then
Set olItem = SendItem
Set olInsp = olItem.GetInspector
'// Execute Recall command button
With olInsp
.Display
.CommandBars.FindControl(, 2511).Execute
.Close olDiscard
End With
End If
End Sub发布于 2016-08-25 02:34:06
指示消息是否成功召回的项是ReportItem。
Private Sub Display_TypeOf()
Dim item As Object
Dim msgClass As String
For Each item In ActiveExplorer.Selection
msgClass = vbCr & vbCr & "Class Is " & item.Class
If TypeOf item Is mailItem Then
MsgBox "Subject: " & item.Subject & vbCr & vbCr & "TypeOf Item is mailItem." & msgClass
ElseIf TypeOf item Is ReportItem Then
MsgBox "Subject: " & item.Subject & vbCr & vbCr & "TypeOf Item is ReportItem" & msgClass
ElseIf TypeOf item Is PostItem Then
MsgBox "Subject: " & item.Subject & vbCr & vbCr & "TypeOf Item is PostItem" & msgClass
ElseIf TypeOf item Is MeetingItem Then
MsgBox "Subject: " & item.Subject & vbCr & vbCr & "TypeOf Item is MeetingItem" & msgClass
ElseIf TypeOf item Is AppointmentItem Then
MsgBox "Subject: " & item.Subject & vbCr & vbCr & "TypeOf Item is AppointmentItem" & msgClass
Else
MsgBox "Subject: " & item.Subject & vbCr & vbCr & "TypeOf Item is not listed in this code." & msgClass
End If
Next
End Subhttps://stackoverflow.com/questions/33146033
复制相似问题