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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Outlook 2003 - Send Receive counter

Status
Not open for further replies.

Legions

MIS
Feb 10, 2003
37
US
Has anyone already created a small outlook program that is able to count how many times SEND/Receive is completed?

Just wondering, search results didn't turn up anything directly but I thought I'd ask so I'm not re-inventing the wheel.

Thanks!

~L
 
Interesting question. This seems to work for me. Place it in your ThisOutlookSession module...

Code:
Private Sub Application_NewMailEx(ByVal EntryIDCollection As String)
    Dim lngMailCount As Long
    Const regAppName As String = "OL_MyAppName"
    Const regSection As String = "OL_Mail"
    Const regKey As String = "OL_MailCount"
    lngMailCount = GetSetting(regAppName, regSection, regKey, 0)
    SaveSetting regAppName, regSection, regKey, lngMailCount + 1
End Sub

This will only fire if you receive an email in your InBox, so it will not fire absolutely every send/receive, but it's the best I could do. I don't think there is an event for just a plain send/receive. There may be if you code through VB/.NET, but I don't think so via VBA.

HTH

Regards,
Zack Barresse

Simplicity is the ultimate sophistication. What is a MS MVP? PODA
- Leonardo da Vinci
 
Oh, and btw, you can call from a standard module like so...

Code:
Sub GetSendReceiveCount()
    Const regAppName As String = "OL_MyAppName"
    Const regSection As String = "OL_Mail"
    Const regKey As String = "OL_MailCount"
    MsgBox "Since 28-Nov-07 you have had " & _
        GetSetting(regAppName, regSection, regKey, 0) & _
        " send/receives.", vbInformation, "COUNT"
End Sub

HTH

Regards,
Zack Barresse

Simplicity is the ultimate sophistication. What is a MS MVP? PODA
- Leonardo da Vinci
 
Thanks for this - but I need something that counts everytime, even without receiving a new mail. I know very odd request but it rolls up into a larger process we are working on.

 
As I said, there is no VBA event to handle this. Sorry. :(

Regards,
Zack Barresse

Simplicity is the ultimate sophistication. What is a MS MVP? PODA
- Leonardo da Vinci
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top