StartDownloadsServiceSamplesWorkshopsContact DeutschEnglish
 
Samples
General
Outlook®
 
Awarded by
Microsoft since 2005:
mvp logo
VBOffice Info
Visitors1721897
Impressions6479236
Links
Imprint
Privacy Policy
Contact
E-Mail: Delete original when replying
Author: Michael BauerHomepage
Date: 26.09.2006Accessed: 25179
  
Description

This sample shows how to delete an e-mail as soon as you click the Reply button. Outlook creates the reply (and, depending on your settings, with the original text in it) and moves the original into the folder for deleted items.

' <DieseOutlookSitzung>
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
' </DieseOutlookSitzung>

 
 

ReplyAll alerts you before unintentionally replying all, or if you are a confidential BCC recipient of the ... [more]

 

Access the master category list in the blink of an eye, share your categories in a network, get a reminder service, and ... [more]

 

SAM automatically sets the sender, signature, and folder for sent items, for instance based on the recipient ... [more]

 

OLKeeper reliably prevents users from closing their Outlook window and thus possibly missing reminders or ... [more]