Outlook Banter

Outlook Banter (http://www.outlookbanter.com/)
-   Outlook - General Queries (http://www.outlookbanter.com/outlook-general-queries/)
-   -   Auto display of selected incoming email fails (http://www.outlookbanter.com/outlook-general-queries/29874-auto-display-selected-incoming-email.html)

Richard Lewis Haggard October 13th 06 06:36 PM

Auto display of selected incoming email fails
 
I've tried to set up a system wherein selected email automatically displays
but I've done something silly and it does not work.

In short, I've declared an Outlook.Items object which is created at start up
time and associated with a mailbox under the Inbox. An event handler for
this mailbox has been added and it will display the email. I've also created
a rule that moves selected emails into this mailbox. The idea is, email
comes in, the rule places the email in the special box and the event handler
gets triggered which displays the item. Good theory, bad practice. It
doesn't work.

Here's the VBA code:

Private WithEvents ItemsAutoDisplay As Outlook.Items


Private Sub Application_Startup()
Set ItemsAutoDisplay =
Application.Session.GetDefaultFolder(olFolderInbox ).Folders("SDG").Items
End Sub


Private Sub ItemsAutoDisplay_ItemAdd(ByVal Item As Object)
If TypeOf Item Is Outlook.MailItem Then
Item.Display
End If
End Sub

--
Richard Lewis Haggard
www.Haggard-And-Associates.com



Brian Tillman October 13th 06 07:30 PM

Auto display of selected incoming email fails
 
Richard Lewis Haggard HaggardAtWorldDotStdDotCom wrote:

Here's the VBA code:


news://msnews.microsoft.com/microsof...ok.program_vba is the
correct newsgroup for programming questions.
--
Brian Tillman



All times are GMT +1. The time now is 11:35 AM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com