I have two mailboxes in my Outlook.
One that is mine and it automatically logs me in when I log in to my pc and another I have that is for mail bounces.
I really need to access the inbox of the mail’s account but I just can’t seem to do it.
And there is no way I can make the mailbox of the mail account to be my default mailbox
Here is the code I have so far:
Public Sub GetMails() Dim ns As NameSpace Dim myRecipient As Outlook.Recipient Dim aFolder As Outlook.Folders Set ns = GetNamespace('MAPI') Set myRecipient = ns.CreateRecipient('mail@mail.pt') myRecipient.Resolve If myRecipient.Resolved Then MsgBox ('Resolved') Set aFolder = ns.GetSharedDefaultFolder(myRecipient, olFolderInbox) Else MsgBox ('Failed') End If End Sub
The problem I am getting is at the
Set aFolder = ns.GetSharedDefaultFolder(myRecipient, olFolderInbox)
I get the Resolved msgbox so I know that is working but after that I get an error:
Run-Time Error
which doesn’t say much about the error itself.
Can anyone help me out here please? Thanks
If the folder you wish to access is not an Exchange folder, you will need to find it, if it is an Exchange folder, try logging on to the namespace.
Log on to NameSpace
Find Folder As far as I recall, this code is from Sue Mosher.