+ Reply to Thread
Results 1 to 5 of 5

Count emails in Outlook before set date

  1. #1
    Registered User
    Join Date
    05-30-2014
    Location
    Linköping, Sweden
    MS-Off Ver
    2016
    Posts
    23

    Count emails in Outlook before set date

    Hi all,

    I am working on improving one of my work documents where I count a lot of emails that are incoming and as well as counting backlogs.
    I have a working macro that counts all the received during a certain date that I enter as a value, however I am not sure how I can count the backlog.

    What I want to do is:

    I click a button connected to the macro, the macro as an inputbox asking me for a value, the value being a specfic date in the "dd/mm/yyyy" format. The macro then goes into the specified outlook folder and counts all the emails that arrived BEFORE this date.

    I am not sure if it can help but below here is the macro for counting emails for a specific date
    Please Login or Register  to view this content.
    Thankful for any help I can get

  2. #2
    Registered User
    Join Date
    11-19-2012
    Location
    Dublin, Ireland
    MS-Off Ver
    2016
    Posts
    57

    Re: Count emails in Outlook before set date

    Hi,

    If you only need to count these emails then I think it would be easier to use the advanced filter.
    You won't need to loop through all emails in the folder to get the count, so if you are using this to handle large numbers of emails you should see improvement in speed as well.
    Basically, this method works the same as if you typed your search criteria into Outlook search box and read the number of results from the status bar.
    I've modified your code below, see if it works for you.
    The backlog count is displayed in a message box, change this to wherever you need it.
    Lastly, the inputbox will currently accept any input so you are probably right leaving the error handler on till the end of the code, but that's not ideal.

    Greetings from Bray!

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    05-30-2014
    Location
    Linköping, Sweden
    MS-Off Ver
    2016
    Posts
    23

    Re: Count emails in Outlook before set date

    Thanks dOOb!

    The code works very nicely for the backlog count, however there is something I cannot seem to work out.
    When I am trying to have it count only date that was inputted, it always returns zero, and I am not really sure why.

  4. #4
    Registered User
    Join Date
    11-19-2012
    Location
    Dublin, Ireland
    MS-Off Ver
    2016
    Posts
    57

    Re: Count emails in Outlook before set date

    sorry, my bad, the date must be specified using ">= yourdate and <= yourdate plus the upper time limit" instead of just "="
    replace that part of the code with the below and it should fix it:

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    05-30-2014
    Location
    Linköping, Sweden
    MS-Off Ver
    2016
    Posts
    23

    Re: Count emails in Outlook before set date

    Thanks! That works perfectly!
    I haven't tried it on the most email heavy mailbox yet but the speed is really fast so thanks for that as well!

+ 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. 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
  2. Track Outlook Emails - sent emails in Excel
    By baluraipur in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-06-2015, 09:18 AM
  3. search outlook emails at given date range
    By lubbamkt in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-26-2015, 10:41 AM
  4. [SOLVED] Select folder and date range to get emails from Outlook
    By 2sqrd in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-29-2013, 09:51 AM
  5. [SOLVED] Sending Outlook emails from Excel; Limits to three emails only?
    By BPSJACK in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-29-2013, 06:53 AM
  6. Send outlook emails with message in cells to individual emails associated with them
    By abinayan in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-21-2011, 06:11 AM
  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