-
deleting message after reply
hello all,
i am wanting to write a vba for outlook 2010 where the vba will delete a message from a specific sender after i replied to the mail and also delete the reply in the sent folder.
this is my first time dealing with outlook vba though i am quick ok with excel vba.
any help would be much appreciated. thanks
-
I feel obligated to discourage you from doing this. If there is ever a dispute about the content of the message, you'll have no record of what you wrote.
Assign this code to a toolbar button (QAT) and click it when you want to reply to a message and delete both the original and the reply.
[VBA]
Sub ReplyAndDelete()
Dim msg As Outlook.mailItem
Dim replyMsg As Outlook.mailItem
' assume currently selected item is an email you want to reply to
Set msg = ActiveExplorer.Selection.Item(1)
Set replyMsg = msg.Reply
With replyMsg
.Display
' put reply into Deleted Items folder (instead of Sent Items)
Set .SaveSentMessageFolder = session.GetDefaultFolder(olFolderDeletedItems)
End With
' delete original message
msg.Delete
End Sub
[/VBA]
-
thanks JP. will try this and let u know if its ok.
P.S. dont worry about the content of the mail. there will never be any dispute.
-
hello JP,
thats awesome, i just have 2 more questions.
how do i create a button to assign the macro. and how to delete the mail and sent mail permanently.
thanks
-
Hi JP,
ok for the button. just the delete permanently. thanks
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules