У меня есть сценарий 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 ответ1

0

Когда вы перемещаете элемент, создается новый элемент. Вам нужно сделать ответ на новый предмет.

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

Всё ещё ищете ответ? Посмотрите другие вопросы с метками .