Outlook Banter

Outlook Banter (http://www.outlookbanter.com/)
-   Outlook and VBA (http://www.outlookbanter.com/outlook-vba/)
-   -   Monitor another users Mailbox for new mail (http://www.outlookbanter.com/outlook-vba/23194-monitor-another-users-mailbox-new.html)

[email protected] August 8th 06 08:54 AM

Monitor another users Mailbox for new mail
 
Hi All,

Just getting started with Outlook and VBA and am wondering if this is
possible.

I can write a macro that will monitor my Mailbox for incoming mails,
but I would like to monitor another mailbox and have it alert me when a
new message arives.

e.g. We have an IT malbox that myself and someone else monitors. If we
are not at our desk when a new message arrives, we are not alerted. I
would like a message box to permanently be displayed when a new mail
message arrives in the IT mailbox.

Hope someone can point me in the right direction

Thanks in advance,

Sandy


Ken Slovak - [MVP - Outlook] August 8th 06 02:05 PM

Monitor another users Mailbox for new mail
 
If the mailbox is opened as part of your profile you can get the folder you
want, access it's Items collection and handle ItemAdd just as you would with
an Items collection in your own mailbox.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


wrote in message
oups.com...
Hi All,

Just getting started with Outlook and VBA and am wondering if this is
possible.

I can write a macro that will monitor my Mailbox for incoming mails,
but I would like to monitor another mailbox and have it alert me when a
new message arives.

e.g. We have an IT malbox that myself and someone else monitors. If we
are not at our desk when a new message arrives, we are not alerted. I
would like a message box to permanently be displayed when a new mail
message arrives in the IT mailbox.

Hope someone can point me in the right direction

Thanks in advance,

Sandy



[email protected] August 15th 06 11:55 AM

Monitor another users Mailbox for new mail
 
Hi Ken,

Can you give me quick example of the code to do this.

Failing that, can you point me to some info on the web about this.

Thanks in advance,

Sandy


Ken Slovak - [MVP - Outlook] wrote:
If the mailbox is opened as part of your profile you can get the folder you
want, access it's Items collection and handle ItemAdd just as you would with
an Items collection in your own mailbox.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


wrote in message
oups.com...
Hi All,

Just getting started with Outlook and VBA and am wondering if this is
possible.

I can write a macro that will monitor my Mailbox for incoming mails,
but I would like to monitor another mailbox and have it alert me when a
new message arives.

e.g. We have an IT malbox that myself and someone else monitors. If we
are not at our desk when a new message arrives, we are not alerted. I
would like a message box to permanently be displayed when a new mail
message arrives in the IT mailbox.

Hope someone can point me in the right direction

Thanks in advance,

Sandy



Ken Slovak - [MVP - Outlook] August 15th 06 02:15 PM

Monitor another users Mailbox for new mail
 
The ItemAdd event handler would have to be placed in a class module or the
default ThisOutlookSession class module (or in a VBA UserForm). This assumes
use in ThisOutlookSession:

Private WithEvents colItems As Outlook.Items

Private Sub Application_Startup()
Dim oTop As Outlook.MAPIFolder
Dim oFolder As Outlook.MAPIFolder
Dim oNS As Outlook.NameSpace

Set oNS = Application.GetNameSpace("MAPI")

'change the mailbox name to whatever it is.
Set oTop = oNS.Folders.Item("Mailbox - IT")
Set oFolder = oTop.Folders.Item("Inbox")

Set colItems = oFolder.Items
End Sub

Private Sub colItems_ItemAdd(ByVal Item As Object)
'whatever
End Sub

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


wrote in message
oups.com...
Hi Ken,

Can you give me quick example of the code to do this.

Failing that, can you point me to some info on the web about this.

Thanks in advance,

Sandy



[email protected] August 16th 06 01:57 PM

Monitor another users Mailbox for new mail
 
Thanks a lot Ken, all works fine now.

Cheers


Ken Slovak - [MVP - Outlook] wrote:
The ItemAdd event handler would have to be placed in a class module or the
default ThisOutlookSession class module (or in a VBA UserForm). This assumes
use in ThisOutlookSession:

Private WithEvents colItems As Outlook.Items

Private Sub Application_Startup()
Dim oTop As Outlook.MAPIFolder
Dim oFolder As Outlook.MAPIFolder
Dim oNS As Outlook.NameSpace

Set oNS = Application.GetNameSpace("MAPI")

'change the mailbox name to whatever it is.
Set oTop = oNS.Folders.Item("Mailbox - IT")
Set oFolder = oTop.Folders.Item("Inbox")

Set colItems = oFolder.Items
End Sub

Private Sub colItems_ItemAdd(ByVal Item As Object)
'whatever
End Sub

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


wrote in message
oups.com...
Hi Ken,

Can you give me quick example of the code to do this.

Failing that, can you point me to some info on the web about this.

Thanks in advance,

Sandy




All times are GMT +1. The time now is 01:36 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-2006 OutlookBanter.com