通过 VBA 脚本回复的电子邮件不显示带有紫色箭头的回复图标

通过 VBA 脚本回复的电子邮件不显示带有紫色箭头的回复图标

我有一个 VBA 脚本,可以将电子邮件移动到文件夹(对话框)并生成将保存在同一文件夹中的回复。我遇到的问题是原始电子邮件从不显示带有紫色箭头的回复图标。有什么想法我遗漏了什么吗?

Sub FileAndReply()
'This subroutine will move the highlighted email to a user selected folder
'and generate a reply that will be saved in the same folder.
'PROBABLY: Must have Save copy of messages in Sent folder set.
'MAYBE: Must have When replying to a message that is not in the Inbox, save...

Dim olApp As New Outlook.Application
Dim olExp As Outlook.Explorer
Dim olSel As Outlook.Selection
Dim olNS As Outlook.NameSpace
Dim olFolder As Outlook.Folder
Dim olItem As Outlook.MailItem

Set olExp = olApp.ActiveExplorer
Set olSel = olExp.Selection
Set olNS = olApp.GetNamespace("MAPI")

'get folder user wants to put email in
Set olFolder = olNS.PickFolder

If TypeName(olFolder) <> "Nothing" Then
    olSel.Item(1).Move olFolder
    Set olItem = olSel.Item(1).Reply

    'TO BE FIXED: reply object is created, but original message does
    'not get the icon showing replied to purple arrow!

    Set olItem.SaveSentMessageFolder = olFolder
    olItem.Display
Else
    MsgBox ("No folder selected.  Script aborted.")
End If
End Sub

答案1

当您移动一个条目时,就会创建一个新条目。您需要在新条目上进行回复。

Sub FileAndReply()
'This subroutine will move the highlighted email to a user selected folder
'and generate a reply that will be saved in the same folder.
'PROBABLY: Must have Save copy of messages in Sent folder set.
'MAYBE: Must have When replying to a message that is not in the Inbox, save...

Dim olApp As New Outlook.Application
Dim olExp As Outlook.Explorer
Dim olSel As Outlook.Selection
Dim olNS As Outlook.NameSpace
Dim olFolder As Outlook.folder
Dim olItem As Outlook.MailItem

Set olExp = olApp.ActiveExplorer
Set olSel = olExp.Selection
Set olItem = olSel.Item(1)

Set olNS = olApp.GetNamespace("MAPI")

'get folder user wants to put email in
Set olFolder = olNS.PickFolder

If TypeName(olFolder) <> "Nothing" Then
    Set olItem = olItem.Move(olFolder)

    Set olItem = olItem.Reply

    'TO BE FIXED: reply object is created, but original message does
    'not get the icon showing replied to purple arrow!

    Set olItem.SaveSentMessageFolder = olFolder
    olItem.Display
Else
    MsgBox ("No folder selected.  Script aborted.")
End If
End Sub

相关内容