Process items in a shared mailbox
I want to setup a desktop or a sound alert to the message that comes into my shared folder.
I tried this macro, but I've got an error message. The first line became yellow if i tried to run it.
And the GetFolderPath wrong. I used my Mailbox name in this form - > ("**********\Inbox")
Whats the problem???
Private WithEvents olInboxItems As Items
Private Sub Application_Startup()
Dim objNS As NameSpace
Set objNS = Application.Session
' Get function from Working with VBA and non-default Outlook Folders
Set olInboxItems = GetFolderPath("Mailbox name in folder list\Inbox").Items
Set objNS = Nothing
End Sub
Private Sub olInboxItems_ItemAdd(ByVal Item As Object)
On Error Resume Next
Item.Categories = "My Category"
Item.Save
Set myForward = Item.Forward
'this puts the name in the To field
myForward.Recipients.Add "me@domain.com"
myForward.Display ' use .Send to send it automatically
End Sub
I want to setup a desktop or a sound alert to the message that comes into my shared folder.
I tried this macro, but I've got an error message. The first line became yellow if i tried to run it.
And the GetFolderPath wrong. I used my Mailbox name in this form - > ("**********\Inbox")
Whats the problem???
Private WithEvents olInboxItems As Items
Private Sub Application_Startup()
Dim objNS As NameSpace
Set objNS = Application.Session
' Get function from Working with VBA and non-default Outlook Folders
Set olInboxItems = GetFolderPath("Mailbox name in folder list\Inbox").Items
Set objNS = Nothing
End Sub
Private Sub olInboxItems_ItemAdd(ByVal Item As Object)
On Error Resume Next
Item.Categories = "My Category"
Item.Save
Set myForward = Item.Forward
'this puts the name in the To field
myForward.Recipients.Add "me@domain.com"
myForward.Display ' use .Send to send it automatically
End Sub