I try to write some VBA to save the attachment files from some email to a folder But I get the error
Run Time Error '424'
Object Required
This is the code I am trying to use
Sub test_extraer()
Dim olApp As Outlook.Application
Dim objNS As Outlook.NameSpace
Set olApp = Outlook.Application
Set objNS = olApp.GetNamespace("MAPI")
Set Items = objNS.GetDefaultFolder(olFolderInbox).Items
If (Msg.SenderName = "sender@email.com") And _
       (Msg.Subject = "subject of the email") And _
   (Msg.Attachments.Count >= 1) Then
    'Set folder to save in.
    Dim olDestFldr As Outlook.MAPIFolder
    Dim myAttachments As Outlook.Attachments
    Dim Att As String
    Const attPath As String = "C:\temp\"
   Set myAttachments = item.Attachments
    Att = myAttachments.item(1).DisplayName
    myAttachments.item(1).SaveAsFile attPath & Att
End If
End Sub
The error is triggered when the script enter to this if
If (Msg.SenderName = "sender@email.com") And _
       (Msg.Subject = "subject of the email") And _
       (Msg.Attachments.Count >= 1) Then
Any advice
Thanks in advance