Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Couting # of files in Outlook folder by date

Status
Not open for further replies.

utahjzz98

Programmer
Jan 9, 2003
69
US
Hello,

I am trying to count the number of emails in a particular Outlook folder. However, I need the results returned to me by DAY. For example, if there are 3 emails total in the folder I need to know that 1 email is for 01/17/05 and 2 are for 1/23/05. I am able to get a count for the entire folder, but I am unable to figure out how to seperate the items by date.

Any help would be appreciated. My current code is listed below if that helps.

Regards,
Corey

Code:
Private Sub cmdCount_Click()
On Error Resume Next

    Set objNS = Application.GetNamespace("MAPI")
    Set objFolder = objNS.PickFolder
        If objFolder Is Nothing Then
            MsgBox "User pressed cancel"
        Else
            Set objEmails = objFolder.Items
            Dim i As Integer
            
            i = objEmails.Count
            
            MsgBox "Total emails: " & i
        End If
    
    Set objNS = Nothing
    Set objFolder = Nothing
    Set objEmails = Nothing
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top