A Microsoft Outlook email forum. Outlook Banter

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.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

delete email once it has been replyed to in outlook, through VBA code



 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old February 18th 09, 09:57 AM
jinjay jinjay is offline
Junior Member
 
First recorded activity at Outlookbanter: Feb 2009
Posts: 3
Question delete email once it has been replyed to in outlook, through VBA code

Hey Guys,

I'm new to this forum so if i miss anything, apologizes.

I am working in outlook 2003, my goal is to write a code to be able to delete a message once it has been replied to. I have archived this with the following code:-
but now i need to edit this so it only works with a certain subject heading and not every email. Please help

can the code be change so it deletes on predefined subject heading upon hitting reply. at the moment it is deleting any message that is replied to.

Option Explicit
Private WithEvents ReplyButton As Office.CommandBarButton
Private WithEvents m_Inspectors As Outlook.Inspectors
Private m_Mail As Outlook.MailItem

Private Sub Application_Startup()
Set ReplyButton = Application.ActiveExplorer.CommandBars.FindControl (, 354)
Set m_Inspectors = Application.Inspectors
End Sub

Private Sub m_Inspectors_NewInspector(ByVal Inspector As Outlook.Inspector)
On Error Resume Next
If Not m_Mail Is Nothing Then
m_Mail.Delete
Set m_Mail = Nothing
End If
End Sub

Private Sub ReplyButton_Click(ByVal Ctrl As Office.CommandBarButton, _
CancelDefault As Boolean _
)
On Error Resume Next

If TypeOf Application.ActiveWindow Is Outlook.Explorer Then
Set m_Mail = Application.ActiveExplorer.Selection(1)
Else
Set m_Mail = Application.ActiveInspector.CurrentItem
End If
End Sub




I am trying to change the following code so it only deleted
 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
sample code to delete items in folder 24 hours old Tom[_7_] Outlook and VBA 1 September 3rd 08 10:37 PM
code to delete all contacts [email protected] Outlook - General Queries 1 January 15th 08 07:53 AM
Outlook Macro to delete email from Sent Folder and Delete Folder Vishal Outlook and VBA 3 February 24th 07 04:52 AM
How to delete multiple contacts through c# code pramod Add-ins for Outlook 1 December 27th 06 06:22 PM
delete one email contact from outlook email addresses snap Outlook - Using Contacts 2 August 23rd 06 04:14 PM


All times are GMT +1. The time now is 10:39 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.