Código #1:
Private withEvents ortems As outlook.Items
Private Sub Application_Startup()
Dim OutlookApp As Outlook.Application
Dim oNameSpace As Outlook.NameSpace
Set OutlookApp = Outlook.Application
Set oNameSpace = Outlook.GetNamespace("MAPI")
Set oItems = oNameSpace.GetDefaultFolder(olFolderInbox).Items
Debug.Print "Desencadenador iniciado" & VBA.Now
End Sub
Código #2:
Private Sub oltems_ItemAdd(ByVal Item As Object)
Dim myMail As Outlook.MailItem
Dim oAtt As Outlook.Attachment
If VBA.TypeName(Item) = "MailItem" Then
Set myMail = Item
If myMail.Subject Like "*" & "Coincidencia con el Asusto" & "*" Then
For Each oAtt In myMail.Attachments
oAtt.SaveAsFile "Ruta Carpeta" & oAtt.FileName
Next oAtt
End If
End If
Set myMail = Nothing
End Sub