Hi all
What I'm trying to achieve is when a new email comes into a shared inbox, a macro would open this email, run some code I've written which hands over to Excel and then repeat when another email comes in.
If possible, not run when specific criteria are met (such as email has come from person@mail.com or subject is blank for example)
This is the code I'm currently trying which doesn't seem to work:
Could someone point me in the right direction please?![]()
Sub OpenSharedEmail() Dim oRecip As Outlook.Recipient Dim oFolder As Outlook.MAPIFolder Dim oNS As Outlook.NameSpace Dim oSubFolder As Outlook.MAPIFolder Set oNS = Application.GetNamespace("MAPI") Set oRecip = oNS.CreateRecipient("TeamMail") oRecip.Resolve If oRecip.Resolved Then Set oFolder = oNS.GetSharedDefaultFolder(oRecip, olFolderInbox) Set oSubFolder = oFolder.Folders("Inbox") If Not (oSubFolder Is Nothing) Then MsgBox "Item 1 = " & oSubFolder.Items.item(1).Subject Else MsgBox "Could not get folder" End If End If End Sub
Thanks
Aaron
Bookmarks