B
BlockNinja
I have been looking over the Internet for a solution in Outlook 2000 that
will let me show a popup window whenever a new email comes in. In the
ThisOutlookSession all I see is an event for Application_NewMail(), but I
have seen Microsoft MVP's on some sites saying that you should use the
ItemAdd event, however I do not see this in Outlook 2000. Did it not come
around until Office XP?
This is my code right now:
Private Sub Application_NewMail()
Dim myitem As Object
Set myitem =
Me.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox).Items(1)
Dim subj, from As String
subj = myitem.Subject
from = "Receipt"
On Error Resume Next
from = myitem.SenderName
On Error GoTo 0
Shell "c:\mycode\PopupMessage\bin\Debug\PopupMessage.exe """ & from &
""" """ & subj & """", vbNormalNoFocus
Set myitem = Nothing
End Sub
It basically just looks at the first item in the Inbox whenever a NewMail
hits, I then invoke a small Windows app I made in C# (luckily I have Visual
Studio .NET on this computer, just not Office 2003...) that displays the
from/subj for 3 seconds in a small window and quits. I used the On Error b/c
it looks like if the item is a Read Receipt, it doesn't have a SenderName
attached to it.
will let me show a popup window whenever a new email comes in. In the
ThisOutlookSession all I see is an event for Application_NewMail(), but I
have seen Microsoft MVP's on some sites saying that you should use the
ItemAdd event, however I do not see this in Outlook 2000. Did it not come
around until Office XP?
This is my code right now:
Private Sub Application_NewMail()
Dim myitem As Object
Set myitem =
Me.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox).Items(1)
Dim subj, from As String
subj = myitem.Subject
from = "Receipt"
On Error Resume Next
from = myitem.SenderName
On Error GoTo 0
Shell "c:\mycode\PopupMessage\bin\Debug\PopupMessage.exe """ & from &
""" """ & subj & """", vbNormalNoFocus
Set myitem = Nothing
End Sub
It basically just looks at the first item in the Inbox whenever a NewMail
hits, I then invoke a small Windows app I made in C# (luckily I have Visual
Studio .NET on this computer, just not Office 2003...) that displays the
from/subj for 3 seconds in a small window and quits. I used the On Error b/c
it looks like if the item is a Read Receipt, it doesn't have a SenderName
attached to it.