# Outlook VBA to save message after send



## andythepandy (Jul 2, 2006)

Hi,

I want to save any messages that are sent to a folder on my computer.
I've tried Application_ItemSend to capture the send event, but when I call the SaveAs method there, it saves as an unsent message. Is there a way to wait until it has been sent, then save it so things like SentOn are stored?

Thanks


----------



## andythepandy (Jul 2, 2006)

If anyone else comes across this, I found a way to do it:
In the ThisOutlookSession file:

```
Public WithEvents monitedFolderItems As items
Private Sub Application_Startup()

Dim sentItemsFolder As MAPIFolder
Set sentItemsFolder = Application.Session.GetDefaultFolder(olFolderSentMail)
Set monitedFolderItems = sentItemsFolder.items

End Sub

Private Sub monitedFolderItems_ItemAdd(ByVal item As Object)

'Whatever code you want to do with the item you just sent

End Sub
```
The second Sub fires when a new item is added to the 'Sent Items' folder, so there will be a small delay between hitting the Send button and the code running.
Outlook needs a restart before this will work, and I found that any changes you made to the monitedFolderItems_ItemAdd sub needed a restart of outlook to work as well.

Hope that helps someone else


----------

