+ Reply to Thread
Results 1 to 8 of 8

Copying all the emails from Outlook inbox plus subfolders to excel

  1. #1
    Registered User
    Join Date
    09-04-2011
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2007/2010
    Posts
    6

    Copying all the emails from Outlook inbox plus subfolders to excel

    Hi All,

    My query is. Im trying to copy all the email items from outlook inbox,sub folders and public folders to excel. I have tried many codes which were posted online by other experts but for some reason im not able to get them work.

    I have a VBA code shared by one of the experts which lets me choose only one folder at a time. Is there any way we can modify this code to add a functionality to it so that I can select multiple foders to export all the recieved email items to excel. Also, can we append the data exported rather than overwriting it into excel.

    Any help would be greatly appreciated. Thanks in advance.

    Please refer to the code below.
    Please Login or Register  to view this content.

  2. #2
    Registered User
    Join Date
    09-04-2011
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2007/2010
    Posts
    6

    Re: Copying all the emails from Outlook inbox plus subfolders to excel

    Also, a speacial mention to Andy Pope whom I followed from other forums for his great help to his fellow members.

    The code which he helped in optimising for better performance is below.

    Please Login or Register  to view this content.
    Apparently this code was working perfectly fine for the person who originally posted the question. But for me Im getting an error at this line "Set rngOutput = ActiveSheet.Range("A1")" as Öbject Variable or With block variable not set". Please help me in this reagrds.


    Thanks in advance.

    P.S. Im a newbie @ VBA coding.

  3. #3
    Valued Forum Contributor mohd9876's Avatar
    Join Date
    05-04-2011
    Location
    Amman, Jordan
    MS-Off Ver
    Excel 2010
    Posts
    426

    Re: Copying all the emails from Outlook inbox plus subfolders to excel

    try this modification on the code and let me know if it works
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    09-04-2011
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2007/2010
    Posts
    6

    Re: Copying all the emails from Outlook inbox plus subfolders to excel

    Hi Mohd,

    It works magical, thanks heaps for your help. A quick question will it pick emails from Sent, Draft, Deleted & Junk as well??

    Is there anyway I can specify from which folder only it should pick up??

    Thanks again Mohd :D

  5. #5
    Valued Forum Contributor mohd9876's Avatar
    Join Date
    05-04-2011
    Location
    Amman, Jordan
    MS-Off Ver
    Excel 2010
    Posts
    426

    Re: Copying all the emails from Outlook inbox plus subfolders to excel

    If you want to exclude items from the export you specify them like this:
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    09-04-2011
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2007/2010
    Posts
    6

    Re: Copying all the emails from Outlook inbox plus subfolders to excel

    Well this is interesting... It is not looking for subfolders under the main Inbox folder. So its picking up all the emails from Inbox and sent emails, deleted emails etc.. but not subfolders under Inbox.
    And yea I tried excluding the Inbox folder and deleted all the emails from sent and deleted folder except for subfolders. And Im getting an error as "No email items found"

    What do u reckon the problem is??

  7. #7
    Valued Forum Contributor mohd9876's Avatar
    Join Date
    05-04-2011
    Location
    Amman, Jordan
    MS-Off Ver
    Excel 2010
    Posts
    426

    Re: Copying all the emails from Outlook inbox plus subfolders to excel

    try this
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    09-04-2011
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2007/2010
    Posts
    6

    Re: Copying all the emails from Outlook inbox plus subfolders to excel

    Awesome! ... works perfectly It is looping through every folder now. How do I exclude specific folders if I want to?? like you've mention in the previous post??
    And also, how can give headers (From, To and Sent)?? Im sorry too many questions.

    Thanks a trillion

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1