Outlook VBA to execute script on shared mailbox, not main mailbox I am trying to get this VBA script to execute not on my inbox, but on the shared mailbox which is attached to my profile but not directly under my main inbox. It is listed as a separate email box.
Sub sortbysubject()
Const olFolderInbox = 6
Set objOutlook = CreateObject("Outlook.Application")
Set objNamespace = objOutlook.GetNamespace("MAPI")
Set objInbox = objNamespace.GetDefaultFolder(olFolderInbox)
strFolderName = objInbox.Parent
Set objMailbox = objNamespace.Folders("Credit_SP Trading Floor Support")
Set objFolder = objMailbox.Folders("Inbox")
Set colItems = objFolder.Items
For Each objItem In colItems
Wscript.Echo objItem.Subject
Next
End Sub