目前我正在尝试处理从outlook收到的每封电子邮件的主题行。所有主题行都列在F栏上。我希望显示电子邮件的所有主题行(将删除重复项,并且每次会话只保留一行 - RE或FW的邮件已被删除这些)。新工作表将包含收件箱中的所有主题行(删除重复项后仅执行一次)。
代码:
For Each oItem In objSourceFolder.Items
ThisWorkbook.Worksheets("Test 1 Mails").Range("A" & contor).Value = oItem.SentOn
ThisWorkbook.Worksheets("Test 1 Mails").Range("B" & contor).Value = oItem.CreationTime
ThisWorkbook.Worksheets("Test 1 Mails").Range("C" & contor).Value = oItem.ReceivedTime
ThisWorkbook.Worksheets("Test 1 Mails").Range("D" & contor).Value = oItem.SenderName
ThisWorkbook.Worksheets("Test 1 Mails").Range("E" & contor).Value = oItem.SenderEmailAddress
If (Left(oItem.Subject, 4) = "FW: ") Or (Left(oItem.Subject, 4) = "Fw: ") Or (Left(oItem.Subject, 4) = "RE: ") Or (Left(oItem.Subject, 4) = "Re: ") Then
oItem.Subject = Mid(oItem.Subject, 5)
oItem.Save
ThisWorkbook.Worksheets("Test 1 Mails").Range("F" & contor).Value = oItem.Subject
ThisWorkbook.Worksheets("Outlook report").Range("B" & contor).Value = oItem.Subject
Else
If Left(oItem.Subject, 5) = "FWD: " Then
oItem.Subject = Mid(oItem.Subject, 6)
ThisWorkbook.Worksheets("Test 1 Mails").Range("B" & contor).Value = oItem.Subject
ThisWorkbook.Worksheets("Outlook report").Range("B" & contor).Value = oItem.Subject
oItem.Save
End If
End If
答案 0 :(得分:0)
您不需要任何代码来提取所有唯一主题
......完成