Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 144813
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T08:18:46+00:00 2026-05-11T08:18:46+00:00

I have two mailboxes in my Outlook. One that is mine and it automatically

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T08:18:46+00:00Added an answer on May 11, 2026 at 8:18 am

    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

      Set oNS = oApp.GetNamespace('MAPI')   oNS.Logon 

    Find Folder As far as I recall, this code is from Sue Mosher.

    Public Function GetFolder(strFolderPath As String) As Object 'MAPIFolder ' strFolderPath needs to be something like '   'Public Folders\All Public Folders\Company\Sales' or '   'Personal Folders\Inbox\My Folder' ''  Dim apOL As Object 'Outlook.Application ' Dim objNS As Object 'Outlook.NameSpace ' Dim colFolders As Object 'Outlook.Folders ' Dim objFolder As Object 'Outlook.MAPIFolder ' Dim arrFolders() As String Dim I As Long  On Error GoTo TrapError      strFolderPath = Replace(strFolderPath, '/', '\')      arrFolders() = Split(strFolderPath, '\')      Set apOL = CreateObject('Outlook.Application')     Set objNS = apOL.GetNamespace('MAPI')       On Error Resume Next      Set objFolder = objNS.Folders.Item(arrFolders(0))      If Not objFolder Is Nothing Then         For I = 1 To UBound(arrFolders)             Set colFolders = objFolder.Folders             Set objFolder = Nothing             Set objFolder = colFolders.Item(arrFolders(I))              If objFolder Is Nothing Then                 Exit For             End If         Next     End If      Set GetFolder = objFolder     Set colFolders = Nothing     Set objNS = Nothing     Set apOL = Nothing   End Function 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have two issues one is showFromToolbar statement format warning issue and another is that
I have two identical tables and need to copy rows from table to another.
I have two databases I need to work with, one oracle on a remote
Have two actionsheet buttons and one modalviewcontroller on mainviewcontroller in application. Now for two
I have two applications written in Java that communicate with each other using XML
I have two classes, and want to include a static instance of one class
I have two threads, one needs to poll a bunch of separate static resources
I have two spreadsheets... when one gets modified in a certain way I want
I have two tables inside a database. One stores unique userNames and a unique
Have two events: $('body').mouseup(function(e){} and $('.toggle').click(function(e){} I only want one of these to trigger.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.