我有Outlook邮件条目ID,我想要的条目ID的详细信息是To,Subject,Body Ect ..
电子邮件仍在收件箱中,不会移动到任何地方
我在VBA中编写代码
提前致谢..
Private Sub CommandButton4_Click()
i = 0
j = 1
Dim path,FileName As String 设置currentExplorer = Application.ActiveExplorer 设置Selection = currentExplorer.Selection
Set currentMail = objNameSpace.GetItemFromID("000000000AB85207D8C3664BA439B3CE1603D186070019BED8705003484BACA686B84F9C6E880000006DE67E000019BED8705003484BACA686B84F9C6E880000428CEF9B0000")
MailTo = currentMail.To
MailSubject = currentMail.Subject
MailBody = currentMail.Body
MailDateTime = currentMail.CreationTime
attcount = currentItem.Attachments.Count
For j = 1 To attcount + 1
'FileName = "\\wipfs01\ES Quality\Personal Folders\Mahesh\Tools\Sorting-Telus\Attachment\" & Atmt.FileName
'Atmt.SaveAsFile FileName
Set chk = UserForm2.Controls("chkn" & j)
If chk.Value = True Then
path = SaveAttachment("\\wipfs01\ES Quality\Personal Folders\Mahesh\Tools\Sorting-Telus\Attachment\PO\")
FileName = path & currentItem.Attachments(j).FileName
currentItem.Attachments(j).SaveAsFile FileName
Set currentMail = currentItem
MailTo = currentMail.To
MailSubject = currentMail.Subject
MailBody = currentMail.Body
MailDateTime = currentMail.CreationTime
chk.Visible = False
End If
Next j
'MsgBox MailTo & vbCrLf & MailSubject & vbCrLf & MailBody & vbCrLf & MailDateTime
End Sub
答案 0 :(得分:0)
使用Namespace.GetItemFromID使用其条目ID打开邮件。