You can't move an item in ItemSend or you get the error you're getting.
In this case I'd not do that but instead I'd set SaveSentMessageFolder:
Set Item.SaveSentMessageFolder = objFolder
That will save the item when the send is complete to the designated folder
automatically with no further intervention from you.
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm
"Robin" wrote in message
...
Thanks Ken! The procedure works great on new emails, but I now have a
problem
with "reply" and "forward" emails (very strange!). An error message comes
up:
"Send operation failed because item was deleted before it was sent". Any
ideas? My code so far:
Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim answer As Long
Dim objFolder As Outlook.MAPIFolder
Dim oSent As Outlook.MAPIFolder
Dim objNS As Outlook.NameSpace
If Item.Class = olMail Then
answer = MsgBox("SAVE subj: " & _
Item.Subject & " to Sent Items?", vbYesNo)
If answer = vbNo Then
On Error Resume Next
Set objNS = Application.GetNamespace("MAPI")
Set oSent = objNS.GetDefaultFolder(olFolderSentMail)
Set objFolder = oSent.Folders("Temp Sent")
If objFolder Is Nothing Then
MsgBox "This folder doesn't exist!", vbOKOnly + vbExclamation,
"INVALID FOLDER"
End If
If Application.ActiveInspector Is Nothing Then
'Require that this procedure be called for an open item
Exit Sub
End If
If Application.ActiveInspector.CurrentItem.Class olMail Then
Exit Sub
End If
Application.ActiveInspector.CurrentItem.Move objFolder
Set objFolder = Nothing
Set oSent = Nothing
Set objNS = Nothing
Item.DeleteAfterSubmit = True
End If
End If
End Sub