Tools Links Login

Check your Outlook Inbox for new messages . . .

Checks you Microsoft Outlook Inbox for new Mail Items.

Original Author: Tim Ford

Assumptions

Need to set "References" to Microsoft Outlook.

Returns

The number of new messages

Code

Dim objOutlook As Outlook.Application
Dim objMapiName As Outlook.NameSpace
Dim intCountUnRead As Integer
Private Sub Check_Mail_Click()
Set objOutlook = New Outlook.Application
Set objMapiName = objOutlook.GetNamespace("MAPI")

For I = 1 To objMapiName.GetDefaultFolder(olFolderInbox).UnReadItemCount

  intCountUnRead = intCountUnRead + 1

Next

  MsgBox "You have " & intCountUnRead & " new messages in your Inbox . .
  ",   vbInformation + vbOKOnly, "New Messages . . ."
  intCountUnRead = 0
Set objMapiName = Nothing
Set objOutlook = Nothing

End Sub

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 84 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.