Consulting

Results 1 to 3 of 3

Thread: Some folders not found in outlook

  1. #1

    Some folders not found in outlook

    Hi All,

    This is a continuing from my previous code but where the a specific folder isnt found.

    I am able to extract what I need from almost any folder in a shared mailbox except certain ones. I even tried my code on a different computer with a different user.

    In the code below, I am unable to Set Folder = Folder.Folders("CHRISTINA"). The error message says that the object isnt found. However I am able to set a different at the same hierarchy with Set Folder = Folder.Folders("Anne").

    Client support --> Inbox --> Anne works fine but not

    Client support --> Inbox --> Christina.

    Any ideas?

    Thank you


    Sub getDataFromOutlook()


    Dim OutlookApp As Outlook.Application
    Dim OutlookNamespace As Namespace
    Dim Folder As MAPIFolder
    Dim OutlookMail As Variant
    Dim i As Integer


    Dim strMailboxName As String


    strMailboxName = "client support"




    strMailboxName1 = "Inbox"






    Set OutlookApp = New Outlook.Application


    Set OutlookNamespace = OutlookApp.GetNamespace("MAPI")


    Set Folder = OutlookNamespace.Folders("Client support")


    Set Folder = Folder.Folders("Inbox")


    Set Folder = Folder.Folders("CHRISTINA")






    i = 1




    For Each OutlookMail In Folder.Items






    If OutlookMail.ReceivedTime >= Range("Start_of_Month").Value Then

    If OutlookMail.ReceivedTime <= Range("End_of_Month").Value Then


    Range("Email_Sender").Offset(i, 0) = OutlookMail.SenderName
    Range("Email_Sender").Offset(i, 0).Columns.AutoFit
    Range("Email_Sender").Offset(i, 0).VerticalAlignment = xlTop

    Range("Email_Date").Offset(i, 0) = OutlookMail.SentOn
    Range("Email_Date").Offset(i, 0).Columns.AutoFit
    Range("Email_Date").Offset(i, 0).VerticalAlignment = xlTop


    i = i + 1


    End If

    End If


    Next OutlookMail




    Set Folder = Nothing
    Set OutlookNamespace = Nothing
    Set OutlookApp = Nothing





    End Sub

  2. #2
    Is the folder named Folder.Folders("CHRISTINA")
    or
    Folder.Folders("Christina")
    ?
    Graham Mayor - MS MVP (Word) 2002-2019
    Visit my web site for more programming tips and ready made processes
    http://www.gmayor.com

  3. #3
    Hey,

    I managed to solve it by renaming the folder into a different name. The code is now able to find the Folder.

    Thanks again!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •