StartDownloadsServiceSamplesWorkshopsContact DeutschEnglish
 
Samples
General
Outlook®
 
Awarded by
Microsoft since 2005:
mvp logo
VBOffice Info
Visitors1826079
Impressions6849263
Links
Imprint
Privacy Policy
Contact
Open the next e-mail and delete the read one
Author: Michael BauerHomepage
Date: 08.01.2007Accessed: 21010
  
Description

If you have opened an e-mail then you can use two toolbar buttons to move to the next or previous e-mail. If you move on and want to delete the read e-mail then that's not easy: Either you switch to the folder view, select the formerly read e-mail and hit detele, or you have to delete the currently opened e-mail before moving to the next item - but then the window closes and you can't move easily to the next item.

This sample shows how to move with a single click to the next e-mail and delete the read one.

Note: The sample doesn't work in Outlook 2000 if word is your mail editor because then the NewInspector event doesn't fire.

When the e-mail window is opened, please customize the toolbar and create a new button that calls the 'NextItemAndDeleteCurrent' function.

' <DieseOutlookSitzung>
Option Explicit

Private WithEvents m_Inspectors As Outlook.Inspectors
Private WithEvents m_Inspector As Outlook.Inspector
Private WithEvents m_NextButton As Office.CommandBarButton

Private Sub Application_Startup()
  Set m_Inspectors = Application.Inspectors
End Sub

Private Sub m_Inspector_Close()
  Set m_NextButton = Nothing
  Set m_Inspector = Nothing
End Sub

Private Sub m_Inspectors_NewInspector(ByVal Inspector As Outlook.Inspector)
  Dim obj As Object

  If Len(Inspector.CurrentItem.EntryID) Then
    Set m_Inspector = Inspector
    Set obj = Inspector.CommandBars.FindControl(, 360)
    If TypeOf obj Is Office.CommandBarPopup Then
      Set m_NextButton = obj.Controls(1)
    Else
      Set m_NextButton = obj
    End If
  End If
End Sub

Public Sub NextItemAndDeleteCurrent()
  Dim CurrItem As Object

  Set CurrItem = Application.ActiveInspector.CurrentItem
  If Len(CurrItem.EntryID) Then
    m_NextButton.Execute
    CurrItem.Delete
  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]