Sub GetFromInbox()
Dim olApp As Outlook.Application
Dim olNs As Namespace
Dim Fldr As MAPIFolder
Dim olMail As Variant
Dim i As Integer
Set olApp = New Outlook.Application
Set olNs = olApp.GetNamespace("MAPI")
Set Fldr = olNs.GetDefaultFolder(olFolderInbox)
i = 0
For Each olMail In Fldr.Items
If olMail.UnRead Then
i = i + 1
End If
Next olMail
MsgBox Str(i)
Set Fldr = Nothing
Set olNs = Nothing
Set olApp = Nothing
End Sub