Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

outlook access added mail box under personal folder

Posted on 2013-12-07
2
291 Views
Last Modified: 2013-12-22
have the below code that will roll through the inbox but need to access the added folder mail.abc.com
the code works for the inbox but need to cycle through the code in the mail.abc.com see image.
not sure of the syntax to change to access this folder
any help would be appreciated


Sub GetFromInbox()

    Dim olApp As Outlook.Application
    Dim olNs As NameSpace
    Dim Fldr As MAPIFolder
    Dim olMail As Variant
    Dim i As Integer

    Set olApp = New Outlook.Application
    Set olNs = olApp.GetNamespace("MAPI")
    Set Fldr = olNs.GetDefaultFolder(olFolderInbox)
 
    For Each olMail In Fldr.Items

       MsgBox olMail.Body
   
    Next olMail

    Set Fldr = Nothing
    Set olNs = Nothing
    Set olApp = Nothing

End Sub

pic
0
Comment
Question by:sydneyguy
2 Comments
 
LVL 20

Accepted Solution

by:
ltlbearand3 earned 500 total points
ID: 39703830
Not completely sure what folder you need to view in your email folders.  It sounds like you have an additional folder in mail.abc.com you want to access.  You could do that with some code like this:

    Dim Fldr2 As MAPIFolder
	Set Fldr2 = Outlook.Session.Folders("mail.abc.com").Folders("OtherSubFolder")

Open in new window


If you are wanting the inbox in the personal folders then you could do something like this:
    Dim Fldr2 As MAPIFolder
	Set Fldr2 = Outlook.Session.Folders("Personal Folders").Folders("OtherSubFolder")

Open in new window


There are many other ways to approach this, but I would need some clearer details to be able to help more.

-Bear
0
 

Author Closing Comment

by:sydneyguy
ID: 39735492
thanks for your help
0

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This process describes the steps required to Import and Export data from and to .pst files using Exchange 2010. We can use these steps to export data from a user to a .pst file, import data back to the same or a different user, or even import data t…
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question