PC Review


Reply
Thread Tools Rate Thread

Received Date/Time troubling me

 
 
New Member
Join Date: Apr 2012
Posts: 1
 
      28th Apr 2012
Hello Outlook and VBA masters,

Scenario:
We have a mailbox at work which contains more than a 100k mail in a few of the folders. It takes ages to sort the mail inside the folder on outlook. Don't ask me to archive it not in my control. I need to get the number of mail received yesterday and also their sender, subject and received time. I have written code in excel which does this.

My troubles begin now. When I look at the count of mail, I realise that mail received at 12:00 AM were not being counted in. Upon further analysis, I see that Outlook rounds up the seconds in date/time when it "displays" the folder on front end. Thus effectively including any mail received say at 4/27/2012 11:59:31 PM into the next day's mail count. I used the round function in VBA but that didn't help. I have now written the code as below:

Quote:
dtReceivedDate = olMailItem.ReceivedTime

' If the mail item being processed has been recieved after 23:59:30,
' increment the date by 1 thus rounding the time and counting it to the next day's count.
If Hour(dtReceivedDate) = 23 And Minute(dtReceivedDate) = 59 And Second(dtReceivedDate) >= 30 Then
dtReceivedDate = DateSerial(Year(dtReceivedDate), Month(dtReceivedDate), Day(dtReceivedDate))
dtReceivedDate = dtReceivedDate + 1
Else
dtReceivedDate = DateSerial(Year(dtReceivedDate), Month(dtReceivedDate), Day(dtReceivedDate))
End If

If dtReceivedDate = dtYesterdaysDate Then start counting...
Please let me know if there is a better way of handling this. If there is any way of getting "Yesterday's mail" as Outlook displays, it will be a great joy for me.. I haven't got a chance to test the above code in that mailbox as it is a work thingy and i wont be in till Monday. I'm trying to get this sorted out before i go in to work on Monday.

I would appreciate all assistance in this. Thank You and have a great weekend!!
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
troubling with "Refreshing" online pages. =?Utf-8?B?ZGxwZXBzaWNvbGE=?= Windows XP Help 1 19th Nov 2004 02:07 AM
Troubling opening web site with Frontpage 03 =?Utf-8?B?cGF0cmlvdGdvbGQ=?= Microsoft Frontpage 1 17th Nov 2004 04:53 PM
help: troubling shooting hibernate Rajeev Jain Windows XP General 0 8th May 2004 06:16 AM
troubling with roaming profile on newly added machine to domain DC Gringo Microsoft Windows 2000 Networking 0 20th Oct 2003 09:18 PM
troubling with roaming profile on newly added machine to domain DC Gringo Microsoft Windows 2000 0 20th Oct 2003 09:18 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:03 AM.