title: Accessing another maibox in outlook using vba
body: <p>I have two mailboxes in my Outlook. </p>
  
  <p>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. </p>
  
  <p>I really need to access the inbox of the mail's account but I just can't seem to do it.</p>
  
  <p>And there is no way I can make the mailbox of the mail account to be my default mailbox</p>
  
  <p>Here is the code I have so far:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>The problem I am getting is at the </p>
  
  <p><code>Set aFolder = ns.GetSharedDefaultFolder(myRecipient, olFolderInbox)</code></p>
  
  <p>I get the Resolved msgbox so I know that is working but after that I get an error:</p>
  
  <blockquote>
    <p>Run-Time Error </p>
  </blockquote>
  
  <p>which doesn't say much about the error itself.</p>
  
  <p>Can anyone help me out here please? 
  Thanks</p>