Hello, I am trying to adapt this code for using the macro only in unread emails in a shared box my Inbox, but I don’t get anything that works. Someone for helping me? THanks in advance.

Public Sub Unread_eMails()

Dim myNameSpace As Outlook.NameSpace

Dim myInbox As Outlook.Folder

Dim myDestFolder As Outlook.Folder


Set myNameSpace = Application.GetNamespace("MAPI")

Set myInbox = myNameSpace.GetDefaultFolder(olFolderInbox)

Set myDestFolder = myInbox.Folders("CHECK")


For Each MyItem In myInbox 'HERE my macro stopped and I don't know why



If myInbox.UnReadItemCount <> 0 Then 'It does not work


If InStr(MyItem.Body, "alarm") > 0 Then

MyItem.Move myDestFolder

Else

If InStr(MyItem.Subject, "Urgent") > 0 Then

MyItem.Move myDestFolder


End If

End If


MyItem.UnRead = False

End If

Next MyItem

End Sub