![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
![]()
Hey Eric
I had a look at this post and I have modified the code to move an email that I am sending into a temporary folder if I dont think that I will need. It works fine on a new email but for forwarded mails (go figure!) gives an error message "The Send operation failed because the item was deleted before it was sent". It does send the mail to the "TEMP SENT" folder though. Any ideas what is causing this? My code: Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean) Dim answer As Long Dim objFolder As Outlook.MAPIFolder, objInbox 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 objInbox = objNS.GetDefaultFolder(olFolderInbox) Set objFolder = objInbox.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 objInbox = Nothing Set objNS = Nothing End If End If End Sub "Gus Darino" wrote: Can you provide a variation of this macro that will move the emails to a folder on a "personal folder" (PST) file instead? Auto Archive lets me do this on a scheduled basis but I need to be able to move emails manually. The solution you provided gets me there with the adjustment above. Thank you GusDarino *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Macro to create new email message with different account as sender | Brian Beck | Outlook and VBA | 1 | March 22nd 07 12:15 AM |
Macro to open a new Task and assign it a specific category | Steve Marshall | Outlook and VBA | 1 | November 9th 06 07:01 AM |
How ...When i move a message to a specific map... | Ikku de Dikku | Outlook - General Queries | 3 | September 21st 06 02:26 PM |
Macro to foward just a specific part of an email body of message | [email protected] | Outlook and VBA | 6 | August 21st 06 10:07 PM |
How do you set-up Outlook 2003 without the duplicate Personal Fold | Sue | Outlook - Installation | 3 | May 1st 06 12:11 AM |