Hello,
I have a question about new email notification in outlook when I use also shared mailbox, as it doesn't work. I see only notifications from my first mailbox and not from the shared one. I know that there are two ways of solving this issue, I can make a rules or do this by macro. I cannot make rules on shared mailbox as I am not administrator so I have to choose a second option. I would like to add macro which show me notification when new email came into shared mailbox. I found such code in internet:
Private WithEvents Items As Outlook.Items
Private Sub Application_Startup()
Dim Ns As Outlook.NameSpace
Set Ns = Application.GetNamespace("MAPI")
Set Items = GetFolderPath("Accounting\Inbox").Items
End Sub
Private Sub Items_ItemAdd(ByVal Item As Object)
On Error Resume Next
MsgBox "new message from " & Item.SenderName & " in shared folder"
End Sub
As I am not skilled in macros at all its to less information for me.
I am using Office 365 and I see 3 tabs in VB in Outlook
Project1
- Microsoft Outlook Objects
>ThisOutlookSession
-Modules
>Module1
-Class Modules
>Class1
I read that to run this macro I should put provided code in ThisOutlookSession.
Q1: Is does mean that I should remove rest of the tabs?
Q2: Should this macro be on my macros list?
Its only possible when I add :
Sub macro()
End Sub
somewhere ( when my macro is called macro )
Please advice should it be added somewhere in code? And on which tab exactly?
Q3: Could someone provide me code when my shared mailbox is calling XYZ, so I will know exactly which part I should update?
Thank you very much in advance.
Kind regards
I have a question about new email notification in outlook when I use also shared mailbox, as it doesn't work. I see only notifications from my first mailbox and not from the shared one. I know that there are two ways of solving this issue, I can make a rules or do this by macro. I cannot make rules on shared mailbox as I am not administrator so I have to choose a second option. I would like to add macro which show me notification when new email came into shared mailbox. I found such code in internet:
Private WithEvents Items As Outlook.Items
Private Sub Application_Startup()
Dim Ns As Outlook.NameSpace
Set Ns = Application.GetNamespace("MAPI")
Set Items = GetFolderPath("Accounting\Inbox").Items
End Sub
Private Sub Items_ItemAdd(ByVal Item As Object)
On Error Resume Next
MsgBox "new message from " & Item.SenderName & " in shared folder"
End Sub
As I am not skilled in macros at all its to less information for me.
I am using Office 365 and I see 3 tabs in VB in Outlook
Project1
- Microsoft Outlook Objects
>ThisOutlookSession
-Modules
>Module1
-Class Modules
>Class1
I read that to run this macro I should put provided code in ThisOutlookSession.
Q1: Is does mean that I should remove rest of the tabs?
Q2: Should this macro be on my macros list?
Its only possible when I add :
Sub macro()
End Sub
somewhere ( when my macro is called macro )
Please advice should it be added somewhere in code? And on which tab exactly?
Q3: Could someone provide me code when my shared mailbox is calling XYZ, so I will know exactly which part I should update?
Thank you very much in advance.
Kind regards