I have two mailboxes in my Outlook.
The one that belongs to me, and it automatically registers me when I log on to my computer, and I have another one for mail failures.
I really need to access the mailbox of the mail account, but I just can't do it.
And I can not make the mailbox of the mail account my default mailbox
Here is the code that I still have:
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 get is on
Set aFolder = ns.GetSharedDefaultFolder(myRecipient, olFolderInbox)
I get the allowed msgbox, so I know that it works, but after that I get the error message:
Runtime error
which does not indicate the error itself.
Can someone help me here please? Thanks