Solved

outlook access added mail box under personal folder

Posted on 2013-12-07
2
296 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
[X]
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
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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

Changing a few Outlook Options can help keep you organized!
If you troubleshoot Outlook for clients, you may want to know a bit more about the OST file before doing your next job. IMAP can cause a lot of drama if removed in the accounts without backing up.
Viewers will learn the different options available in the Backstage view in Excel 2013.
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

687 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