+ Reply to Thread
Results 1 to 7 of 7

VBA Count Emails in outlook mail box and enter count and oldest email date into excel cell

  1. #1
    Forum Contributor
    Join Date
    07-31-2009
    Location
    Lincoln, USA
    MS-Off Ver
    Excel 2007 and excel 2010
    Posts
    142

    VBA Count Emails in outlook mail box and enter count and oldest email date into excel cell

    Hello - I found some great code in some very old threads but the code only displays a msg box with the email count.

    I'm trying to adjust so it not only counts the number of emails in a designated inbox but also gives the date of the oldest email in the inbox then places the count and date into designated cells in the sheet.

    Original Code

    Please Login or Register  to view this content.
    I've tried adjusting the MsgBox statement to a Range = value statement (Below) but all it's doing is adding the phrase and not the count.

    Please Login or Register  to view this content.
    How do I add an oldest email date and entering the data into the designated cells?

    I've searched a lot of forums without luck.

    Thank you in advance.
    Last edited by fireguy7; 05-23-2018 at 11:09 AM.

  2. #2
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,855

    Re: VBA Count Emails in outlook mail box and enter count and oldest email date into excel

    Something like below?
    Basically sorts items in folder.items collection (ascending), and reads ReceivedTime of first item.
    This only sorts collection in code and not the actual inbox.

    Please Login or Register  to view this content.
    Last edited by CK76; 05-23-2018 at 11:03 AM.
    ?Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something.?
    ― Robert A. Heinlein

  3. #3
    Forum Contributor
    Join Date
    07-31-2009
    Location
    Lincoln, USA
    MS-Off Ver
    Excel 2007 and excel 2010
    Posts
    142

    Re: VBA Count Emails in outlook mail box and enter count and oldest email date into excel

    Thanks CK76 that's perfect! I was close with some of the adjustments I was making and it always seems to be one missing period or statement that I'm missing. I'll get there with the help of great people like you.

    Much appreciated.

  4. #4
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,855

    Re: VBA Count Emails in outlook mail box and enter count and oldest email date into excel

    You are welcome and thanks for the rep

  5. #5
    Forum Contributor
    Join Date
    07-31-2009
    Location
    Lincoln, USA
    MS-Off Ver
    Excel 2007 and excel 2010
    Posts
    142

    Re: VBA Count Emails in outlook mail box and enter count and oldest email date into excel

    One quick follow up to the above.

    I'm trying to adjust the code so it only return a count and oldest date of any unread items in the designated inbox.

    I've tried adjusting the code

    Please Login or Register  to view this content.
    but that's returning a zero and the same date.

    I've also tried to insert an extra item

    Please Login or Register  to view this content.
    I'm not getting errors but not the results I'm looking for.

    what am I missing?

  6. #6
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,855

    Re: VBA Count Emails in outlook mail box and enter count and oldest email date into excel

    This works for me.
    Please Login or Register  to view this content.
    Last edited by CK76; 05-24-2018 at 11:25 AM.

  7. #7
    Forum Contributor
    Join Date
    07-31-2009
    Location
    Lincoln, USA
    MS-Off Ver
    Excel 2007 and excel 2010
    Posts
    142

    Re: VBA Count Emails in outlook mail box and enter count and oldest email date into excel

    Yep that did it and yet again I missed one little part to fix on my own.

    thanks again!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Macro to take count of emails in each folder and subfolder from outlook mailbox
    By saurabhlotankar in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-07-2017, 01:33 AM
  2. [SOLVED] Use VBA to get count of emails in Outlook folder
    By catalystsystems in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-05-2017, 06:02 PM
  3. [SOLVED] Count emails in Outlook before set date
    By Stromming in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-19-2016, 06:51 AM
  4. Excel VBA to count emails each day in shared outlook folder
    By k1989l in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-28-2016, 04:29 AM
  5. Replies: 0
    Last Post: 09-13-2015, 04:43 PM
  6. Replies: 8
    Last Post: 03-11-2015, 07:53 PM
  7. Macro to count emails in outlook
    By vijanand1279 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-16-2011, 04:53 AM

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