Пишу макрос для Outlook VBA. Нужно сохранить письмо в выбранную папку. Код проходит без ошибок, но письмо не сохраняется там где надо.
o save the sent letter to the selected folder? Item.SaveSentMessageFolder doesn't work. There are no errors during debug
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim message As String
Dim header As String
Dim selectFolderName As String
Dim selectFolderItem As Outlook.MAPIFolder
Dim oOutlook As New Outlook.Application
Dim MyData As DataObject
Set MyData = New DataObject
message = "Do you want to save the letter to a folder?"
header = "Save"
If MsgBox(message, vbYesNo + vbQuestion, header) = vbYes Then
SavePopUp.Show
MyData.GetFromClipboard
selectFolderName = MyData.GetText(1)
Set oNameSpace = oOutlook.GetNamespace("MAPI")
Set selectFolderItem = oNameSpace.Folders(1).Folders.Item("Projects").Folders.Item(selectFolderName)
Set Item.SaveSentMessageFolder = selectFolderItem
End If
End Sub