VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Check your Outlook Inbox for new messages . . .

by Thirst Technologies (1 Submission)
Category: OLE/COM/DCOM/Active-X
Compatability: Visual Basic 3.0
Difficulty: Unknown Difficulty
Date Added: Wed 3rd February 2021
Rating: (7 Votes)

Checks you Microsoft Outlook Inbox for new Mail Items.

Assumes
Need to set "References" to Microsoft Outlook.
Code Returns
The number of new messages

Rate Check your Outlook Inbox for new messages . . .

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

Download this snippet    Add to My Saved Code

Check your Outlook Inbox for new messages . . . Comments

No comments have been posted about Check your Outlook Inbox for new messages . . .. Why not be the first to post a comment about Check your Outlook Inbox for new messages . . ..

Post your comment

Subject:
Message:
0/1000 characters